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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
TijnK
Frequent Visitor

Need help with calculating differences in table

Hello,

 

I need some help. I want to calculate the difference between each column in a table. Each quarter the data get refreshed with another quarter, thus new data. When that happens I want to add the new quarter automatically and calculate the differences between quarters. So this has to be dynamic. This easily done in Excel, but but I cannot seem to find the solution in Power BI.

 

As you can see in picture 1: A simple example in Excel. Getting the differences between previous and next quarter 

 

now I want to do the same in powerBI. But I cannot seem to get the same results:

Picture 2: Power BI 

 

This is the measure calculation. 

Difference = 
var CurrentYear = MAX('wia-overzicht'[kwartaal])
return
CALCULATE(SUM('wia-overzicht'[reserve]);FILTER(ALL('wia-overzicht');'wia-overzicht'[kwartaal]=CurrentYear-1))


Can you guys please help me. I dont know what I do wrong here. 

 

Best regards,

 

 

 Tijn

1 ACCEPTED SOLUTION

Hi Smoupre,

 

Thank you for your answer. However, I just got the answer (by luck) this afternoon.

 

The quartes were in text form. So I changed the data-type and the rewrote the code like this:

Totaal reserve bedrag = CALCULATE(sum('wia-overzicht'[reserve]))

Vorige kwartaal = CALCULATE([Totaal reserve bedrag]; PREVIOUSQUARTER('wia-overzicht'[Parsekwartaal]))

Verschil in Euro's = 
var resultaat = [Totaal reserve bedrag] - if( [Vorige kwartaal] = BLANK(); [Totaal reserve bedrag];[Vorige kwartaal])
return
	if (resultaat=0;BLANK();resultaat)

View solution in original post

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

Can you provide sample data? Very difficult to know exactly what the solution is without something like that.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi Smoupre,

 

Thank you for your answer. However, I just got the answer (by luck) this afternoon.

 

The quartes were in text form. So I changed the data-type and the rewrote the code like this:

Totaal reserve bedrag = CALCULATE(sum('wia-overzicht'[reserve]))

Vorige kwartaal = CALCULATE([Totaal reserve bedrag]; PREVIOUSQUARTER('wia-overzicht'[Parsekwartaal]))

Verschil in Euro's = 
var resultaat = [Totaal reserve bedrag] - if( [Vorige kwartaal] = BLANK(); [Totaal reserve bedrag];[Vorige kwartaal])
return
	if (resultaat=0;BLANK();resultaat)

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.

Top Solution Authors
Top Kudoed Authors