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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

YTD Average

Dear all,

I'm trying to calculate the YTD Average value - but I would need your help on this KPI & DAX language.

Data are like this:

-> Conformity level (Grade A = OK/NON OK per scan/factory/etc.).

 

So I would need to calculate the average of grade A/period and then make the average from the beginning of this year until a specified period (ex. P5 - or 31st May).

 

HerveRC_2020_0-1623397088267.png

 

Hope it's clear - let me know if not.

Best regards

Hervé

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try like this with a date table

 

calculate(averageX(values(Table[period]), calculate(sum(Table[grade A]))), datesytd('Date'[Date]))

 

 

If you year period, make sure they are in a separate table join to this table

 

YTD= CALCULATE(saverageX(values(Table[period]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year]) && 'Date'[period] <= Max('Date'[period]) ))
LYTD = CALCULATE(averageX(values(Table[period]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year])-1 && 'Date'[period] <= Max('Date'[period])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

5 REPLIES 5
v-kelly-msft
Community Support
Community Support

Hi  @Anonymous ,

 

The link you share isnt available,could you pls modify it and share again?

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

Anonymous
Not applicable

Hello @v-kelly-msft 

Can you try again please and tell me if it works? (or may be my organization blocks it).

Hervé

Hi  @Anonymous ,

 

Still unavailable,could you pls paste some sample data for test?

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

amitchandak
Super User
Super User

@Anonymous , Try like this with a date table

 

calculate(averageX(values(Table[period]), calculate(sum(Table[grade A]))), datesytd('Date'[Date]))

 

 

If you year period, make sure they are in a separate table join to this table

 

YTD= CALCULATE(saverageX(values(Table[period]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year]) && 'Date'[period] <= Max('Date'[period]) ))
LYTD = CALCULATE(averageX(values(Table[period]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year])-1 && 'Date'[period] <= Max('Date'[period])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Dear Amitchandak,

I have updloaded the excel sheet -> can you help me having the YTD pbix visual? -> I'm struggling with the formulas.

Hervé

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.