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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Calculating differences across years in a measure

Hi there,

 

im facing the following problem:

 

I have a table with revenue in certain years. The years are in the rows. In the columns i have the revenue for the subsequent years:

 

Unbenannt.PNG

 

Now i want to creat the same table again but instead of revenue i want the delta values for the revenue in comparison to the previous year. So basically it should look like this:

 

Unbenannt.PNG

 

The numbers in red should show up. In black you see the calculation behind that should be done. So for the columns the measure should go and take in each row the revenue from that year and deduct the revenue from previous year.  

 

Here is the example file: https://www.file-upload.net/download-14036939/untitled.pbix.html 

 

Thanks guys!

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous 

if you have date try measure like this and take diff

YTD QTY = TOTALYTD(Sum('order'[Qty]),'Date'[Date])
LYTD QTY = TOTALYTD(Sum('order'[Qty]),dateadd('Date'[Date],-1,year))
Previous Year = CALCULATE(SUM('order'[Qty]), PREVIOUSYEAR('Date'[Date]))

 

If you have year only

This Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))

 

In both case have the date of year table as the separate table

 

Take diff this year - last year

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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