Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Measure gives wrong numbers

Hi guys,

 

I am trying to make some sort of planning: The hours worked and the planned hours should be combined into one running total. For the most part it works just fine, until I get to the cumulative total. (and the total of Test_Total).

 

Capture1.PNG

 

 

 

 

 

 

 

 

 

 

 

Maandnummer: number of the different months.

Hours: Hours that were planned in advance.

Quantity: Actually worked Hours.

 

Test_Total: a measure to decide wether I need Hours or Quantity (based on current month)

Test_Total = IF(DATEDIFF(MAX(TimeTransactions[Date]), NOW(), DAY) > 0, SUM(TimeTransactions[Quantity]), IF(SUM(Forecast[Hours]) = BLANK(), 0, SUM(Forecast[Hours])))

 

Test_FinalTotal =  The cumulative total of Test_Total

Test_FinalTotal = CALCULATE(Test[Test_Total],FILTER(ALL(PowerBI_Calendar[Maandnummer]), PowerBI_Calendar[Maandnummer] <= MAX(PowerBI_Calendar[Maandnummer])))
 
Does anyone know what is going wrong?

 

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi @Anonymous 

Just adjust the formula as below:

Test_FinalTotal 3 = SUMX(FILTER(ALL(PowerBI_Calendar[Maandnummer]), PowerBI_Calendar[Maandnummer] <= MAX(PowerBI_Calendar[Maandnummer])),[Test_Total])

 

or

Test_FinalTotal 2 = SUMX(FILTER(ALL(PowerBI_Calendar), PowerBI_Calendar[Date] <= MAX(PowerBI_Calendar[Date])),[Test_Total])

Result:

2.JPG

 

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-lili6-msft
Community Support
Community Support

hi @Anonymous 

Just adjust the formula as below:

Test_FinalTotal 3 = SUMX(FILTER(ALL(PowerBI_Calendar[Maandnummer]), PowerBI_Calendar[Maandnummer] <= MAX(PowerBI_Calendar[Maandnummer])),[Test_Total])

 

or

Test_FinalTotal 2 = SUMX(FILTER(ALL(PowerBI_Calendar), PowerBI_Calendar[Date] <= MAX(PowerBI_Calendar[Date])),[Test_Total])

Result:

2.JPG

 

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
az38
Community Champion
Community Champion

Hi @Anonymous 

I see your problem.

it looks like you have too much tables here 🙂

check relationships between PowerBI_Calendar and Forecast tables as problem appears when you need to sum up Forecast[Hours]


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
amitchandak
Super User
Super User

@Anonymous , what is wrong and what is expected output

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.