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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.