The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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
Solved! Go to 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)
Can you provide sample data? Very difficult to know exactly what the solution is without something like that.
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)