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
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
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.

Top Solution Authors