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
dannyd
Frequent Visitor

Subtracting between measurements

Hi,

 

I'm struggling with this case for quite some time now, hopefully this community got some tricks up their sleves...

 

So what i wanna do is calculate the savings by subtracting the price year 2 from the price year 1 and multiplying it with the current years bookings. 

 

Another thing that might be good to know is that the prices from year 1 and 2 are measures in the same table.

 

Capture.JPG

 

Thanks for any support!

 
3 REPLIES 3
Anonymous
Not applicable

final =

var sub=[price1]-[price2]

Return

[Count of booking]*Sub

 

 

Thanks,

Pravin Wattamwar

 

If it resolves your problem mark it as solution and give kudos.

Thanks for the quick answer Pravin!

 

What i was not to clear about was that the measures price1 and price2 are the same. Is it perhaps possible to add a filter to your code?

 

Thanks

az38
Community Champion
Community Champion

Hi @dannyd 

try to

Measure = 
var _year1 = 2018
var _year2 = 2019
RETURN
(CALCULATE([price]; YEAR('Table'[Date])=_year1) - CALCULATE([price]; YEAR('Table'[Date])=_year2)) * CALCULATE(Count('Table'[Booking]))

 

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

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.

Top Solution Authors