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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Compare Monthly average with Annual Average in same chart

Hi DAX Magicians,

I need help with a Power BI DAX formula wherein I want to display monthly average for each of my items - the month will be selected by user through a slicer. Against this average, the user also wants to see the annual average from  prior year for that item. I am using below dax measures. The current month is working fine but Prior Year annual average measure is giving incorrect values. Please see the below formulae and help rectify. This is my 1st post so apologies if i missed something. Thank you so much.

 

Current month avg 

Exception Rate % = DIVIDE(SUM(Table[Exceptions]),SUM(Table[Volume Examined]),0))

 

Prior Year Annual Avg =

PY Exception Rate % = CALCULATE(DIVIDE(SUM(Table[Exceptions]),SUM(Table[Volume Examined]),0),PREVIOUSYEAR('Date Table'[Date]))

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , This seems correct. Make sure the Date table is marked as date table, Option on right click of table.

 

Also, Date from the Table should not have timestamp

 


PY Exception Rate % = CALCULATE(DIVIDE(SUM(Table[Exceptions]),SUM(Table[Volume Examined]),0),PREVIOUSYEAR('Date Table'[Date]))

 

or try 

PY Exception Rate % = CALCULATE(DIVIDE(SUM(Table[Exceptions]),SUM(Table[Volume Examined]),0),datesytd(endofyear(dateadd('Date Table'[Date],-1,year))))

 

 

refer if needed Why Time Intelligence Fails - Power bi 5 Savior Steps for TI: https://youtu.be/OBf0rjpp5Hw

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

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , This seems correct. Make sure the Date table is marked as date table, Option on right click of table.

 

Also, Date from the Table should not have timestamp

 


PY Exception Rate % = CALCULATE(DIVIDE(SUM(Table[Exceptions]),SUM(Table[Volume Examined]),0),PREVIOUSYEAR('Date Table'[Date]))

 

or try 

PY Exception Rate % = CALCULATE(DIVIDE(SUM(Table[Exceptions]),SUM(Table[Volume Examined]),0),datesytd(endofyear(dateadd('Date Table'[Date],-1,year))))

 

 

refer if needed Why Time Intelligence Fails - Power bi 5 Savior Steps for TI: https://youtu.be/OBf0rjpp5Hw

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

Many thanks for your help Amit. Much appreciated. It seems the issue was with PREVIOUSYEAR formula as my Financial Year ends in June but by default the PreviousYear takes December as end of FY. The below coding with "30/6" solved the issue. 

 

PREVIOUSYEAR('Date Table'[Date],"30/6")

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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