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
Varshi288
Resolver II
Resolver II

Average price of current year and previous year showing same.

Hi  All, 

I have a problem with the Dax formula to  calcuate avg TP  previous year iwth current year. Both values are showming same. I tried with two different formulas where the result is also same.

Avg TP = DIVIDE(sum(Data[TP $]), sum(Data[Qty]))
AVG TP PRY = CALCULATE([Avg TP],SAMEPERIODLASTYEAR(Period[Year_Month].[Date]))
Avg Price PrY = CALCULATE([Avg TP],PARALLELPERIOD(Period[Year_Month].[Date],-1,YEAR))
Note: My date table is have only date per month.
 
Any help in fine tuning the formula. Thanks in advance.
 
Varshi288_0-1616398418712.png

 


 

Varshi288_1-1616398195814.png

 

2 REPLIES 2
amitchandak
Super User
Super User

@Varshi288 , You need to use a date column along with a date table.

 

example

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),SAMEPERIODLASTYEAR('Date'[Date]))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),previousyear('Date'[Date]))

 

 

refer by Time intelligence fails - https://youtu.be/OBf0rjpp5Hw

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

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

Thanks for reply,

 

Yes I am using date column where I have only one date per moth in the data table sa well as date table.

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.