Percent Calculation not calculating, returning 0

I need to retrieve a decimal or a percent of a job complete. Every way I've written this, I keep ending up with 0.   Any ideas?

Jobs Table, Job Status Percent Column:  SUM([Related Stops][Complete Counter])/COUNT([Related Stops])

I also tried it directly in the Stops table and it results in 0 as well so I'm assuming it's something in how I'm writing the expressions

ZOCO_Unlimited_0-1704060184429.png

Stops Table: COUNT(Select(Stops[Stop ID],AND([Job ID]=[_THISROW].[Job ID],[Status]=Complete)))/
COUNT(Select(Stops[Stop ID],[Job ID]=[_THISROW].[Job ID]))

ZOCO_Unlimited_1-1704060650996.png

 

 

 

Solved Solved
0 6 341
1 ACCEPTED SOLUTION

You need to add 1.0 with your calculation like.. SUM([Related Stops][Complete Counter])/(1.0*COUNT([Related Stops]))

View solution in original post

6 REPLIES 6

You need to add 1.0 with your calculation like.. SUM([Related Stops][Complete Counter])/(1.0*COUNT([Related Stops]))

That worked, thank you. About 5 seconds after it syncs, it goes back to 0. Any idea what's happening?

status resets to 0.gif

It sounds your column type in your data source is not correct. For the percent column, set it as decimal.

Well, that did it.. 
I swear I tried that at one point but it was probably before your first suggestion..  Thank you so much @AleksiAlkio !!

 

For anyone else who runs into this, it was a combination of these two changes:




@AleksiAlkio wrote:

It sounds your column type in your data source is not correct. For the percent column, set it as decimal.


and 

 
 

You need to add 1.0 with your calculation like.. SUM([Related Stops][Complete Counter])/(1.0*COUNT([Related Stops]))



 

Here's more of what's happening:

When I select the jobs and update them, it will reflect the percent complete. Then if I open a job and complete a stop, it sets the percent complete to 0 in my sheet for anything that is not 100%. I highlighted the jobs to watch. I tested and if I complete the job w/ 3 stops, it will leave the 100%. I am having the same issues whether it is a virtual column or a static column. At least in the static column, I can watch what is happening.. 

Sheet Columns & App Formulas:
App Formula for column Count of Related Stops (Number)1*COUNT([Related Stops])
App Formula for column Count of completed Stops (Number) COUNT(SELECT(Stops[Stop ID],AND([Job ID]=[_THISROW].[Job_ID],[Status]=Complete)))
App Formula for column Percent Complete (Percent): [Count of completed Stops]/[Count of Related Stops]

 

status resets to 0 shows in sheet.gif

 

Make sure you are not caught out by rounding! It took me 10 days to find this out!

This can happen with the '/' operator and especially in calculations in the report system.

If in the App use the field type of Percent instead.

For example:

9 / 25  equals 0.36 but is rounded to 0 by the '/' operator!

And the percentage (0 * 100) comes out at 0% rather than (0.36 * 100)

Solution:

Multiply the numerator by 100

(9 * 100) / 25 

 

Top Labels in this Space