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.
Hi the Power BI Community,
I've been able to calculate the YoY percentage change, however, I need to calculate the percentage change from the earliest year (2010) to the latest year(2018) of a data set and display this as a card.
Here are my current calculations which are correct.
The 7.06% calculated below is what I'd like to show as a card visual.
Start | End | Difference | % Change |
2010 | 2018 | 2018-2010 | Difference/2010 |
80,74 | 86,44 | 5,7 | 7,06% |
Thanks
Solved! Go to Solution.
@BICrazy , Try measure like
new measure =
var _max = maxx(allselected(Date),Date[Date])
var _min = minx(allselected(Date),Date[Date])
return
calculate( sum(Table[Value Reff]), filter(allselected('Date'), 'Date'[Date]=_max)) -
calculate( sum(Table[Value Reff]), filter(allselected('Date'), 'Date'[Date]=_min))
or
new measure =
var _max = maxx(all(Date),Date[Date])
var _min = minx(all(Date),Date[Date])
return
calculate( sum(Table[Value Reff]), filter(all('Date'), 'Date'[Date]=_max)) -
calculate( sum(Table[Value Reff]), filter(all('Date'), 'Date'[Date]=_min))
Hi,
Please check the below picture and the attached pbix file.
All measures are in the attached pbix file.
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
@Jihwan_Kim Appreciate the response Jihwan. This option would have also worked as a solution.
Hi,
Please check the below picture and the attached pbix file.
All measures are in the attached pbix file.
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
@Jihwan_Kim Appreciate the response Jihwan. This option would have also worked as a solution.
@BICrazy , Try measure like
new measure =
var _max = maxx(allselected(Date),Date[Date])
var _min = minx(allselected(Date),Date[Date])
return
calculate( sum(Table[Value Reff]), filter(allselected('Date'), 'Date'[Date]=_max)) -
calculate( sum(Table[Value Reff]), filter(allselected('Date'), 'Date'[Date]=_min))
or
new measure =
var _max = maxx(all(Date),Date[Date])
var _min = minx(all(Date),Date[Date])
return
calculate( sum(Table[Value Reff]), filter(all('Date'), 'Date'[Date]=_max)) -
calculate( sum(Table[Value Reff]), filter(all('Date'), 'Date'[Date]=_min))
@amitchandak Thanks a mill. This solution worked like a charm. I just hard-coded the year's as my dataset min year starts at 1960 and max year ends at 2020.
Here is the sample of my Dax:
% Change GDP per capita, PPP (current international $) =
var _min = YEAR( " December 2010" )
var _max = YEAR( "December 2018" )
var _calc =calculate( [Private health expenditure (% of current health expenditure)], filter(ALL( Data_WB_HNP_WDI), Data_WB_HNP_WDI[Year]=_max)) -
calculate( [Private health expenditure (% of current health expenditure)], filter(ALL( Data_WB_HNP_WDI), Data_WB_HNP_WDI[Year]=_min))
return
DIVIDE( _calc, calculate( [Private health expenditure (% of current health expenditure)], filter(ALL( Data_WB_HNP_WDI), Data_WB_HNP_WDI[Year]=_min)), 0 )
Solution:
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
46 | |
28 | |
22 | |
12 | |
8 |
User | Count |
---|---|
75 | |
52 | |
46 | |
15 | |
12 |