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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
phjz
Frequent Visitor

YTD gets calculated in wrong order

I had a YTD calculation which worked well so far:

 

YTD = CALCULATE(AVERAGEX(SUMMARIZE('Data','Data'[CW],"Weekly",[Old_Value_Measure]),[Weekly]),FILTER(all(Calendar),Calendar[Year] = MAX(Calendar[Year]) && Calendar[Date] <= MAX(Calendar[Date])))
 
Now, I have to do some calculation with the Value-Measure for every week: New_Value_Measure = Old_Value_Measure * Total_Universe / Entitled_Universe. Both universe values have also numbers for every week with Total_Universe = CALCULATE(AVERAGE(
'Total Universe'[Wert]),FILTER(...)), Entitled_Universe works the same. The aggregation doesn't matter on a weekly base. So the table looks like this:
WeekOld_Value_MeasureTotal_UniverseEntitled_UniverseNew_Value_MeasureYTD_New
2024-0110,22126211956709222,7422,74
2024-0263,871251453554581144,1283,01

 

Now, the formula for YTD_New produces wrong numbers:
YTD = CALCULATE(AVERAGEX(SUMMARIZE('Data','Data'[CW],"Weekly",[YTD_New]),[Weekly]),FILTER(all(Calendar),Calendar[Year] = MAX(Calendar[Year]) && Calendar[Date] <= MAX(Calendar[Date])))

 

And I know why: The formula calculates the Average for Old_Value_Measure multiplies it with the Average for Total_Universe and divides it with the averarge for Entitled_Universe: 37,04 * 1256786 / 560837 = 83,01

 

But, what I want to do is to calculate the average of the calculated New_Value_Measures per week, so it has to be: 22,74  + 144,12 / 2 = 83,43

 

But unfortunately, I have absolutely no clue how to do this in Power BI. Does anyone have an idea?

 

Thanks a lot!

 

2 REPLIES 2
Anonymous
Not applicable

Hi @phjz 

 

Please try the following DAX:

MEASURE =
CALCULATE (
    SUM ( 'Table'[New_value] ) / COUNTROWS ( 'Table' ),
    FILTER (
        ALL ( 'Calendar' ),
        'Calendar'[Date].[Year] = MAX ( 'Calendar'[Date].[Year] )
            && 'Calendar'[Date] <= MAX ( 'Calendar'[Date] )
    )
)

 

vjialongymsft_0-1716518157405.png

 

 

 

Best Regards,

Jayleny

 

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

 

Thanks for your reply, but that doesn't work for me, because New_Value is a measure: New_Value_Measure = Old_Value_Measure * Total_Universe / Entitled_Universe

So, I can't sum up this measure....

 

Any other ideas?
Thanks!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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