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.
I have monthly recurring tasks and I would like to calculate and visualize these figures. the base data is quite simple (see below), but I can't seem to get this right. I want to calculate the percentage difference between tasks and I would like power bi to show me the percentage difference between two months based on the filtered months that I select.
for example, I want to compare the month 202110 with the month 202210 and see the percentage difference of tasks. And when I change the filter values, I want to compare the months 202209 and 202210 in the same way.
i have huge problems with this. Can anyone help me?
YYYYMM | Task | Value |
202110 | task 1 | 380 |
202110 | task 2 | 550 |
202110 | task 3 | 120 |
202209 | task 1 | 350 |
202209 | task 2 | 520 |
202209 | task 3 | 150 |
202210 | task 1 | 400 |
202210 | task 2 | 500 |
202210 | task 3 | 100 |
Solved! Go to Solution.
Hi @AtomFiske ,
In this case you just need to change the second argument of the division use the following metric:
Variation =
DIVIDE (
CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[YYYYMM] = MAX ( 'Table'[YYYYMM] ) )
- CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[YYYYMM] = MIN ( 'Table'[YYYYMM] ) ),
CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[YYYYMM] = MIN ( 'Table'[YYYYMM] ) )
)
If you want to present the values based on the YYYYMM also then you need to make some changes, this can be an option:
Variation =
IF(ISINSCOPE('Table'[YYYYMM]), SUM('Table'[Value]),
FORMAT(DIVIDE (
CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[YYYYMM] = MAX ( 'Table'[YYYYMM] ) )
- CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[YYYYMM] = MIN ( 'Table'[YYYYMM] ) ),
CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[YYYYMM] = MIN ( 'Table'[YYYYMM] ) )
), "#.00%"))
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi! Thank you @MFelix ! This is pretty close, but not quite what I was trying to describe. I probably didn't describe my problem well enough. I will try again with a picture.
I want to compare the task-specific percentage difference (see the red numbers on the picture) of the two months I selected with the filter, but I don't understand how to make this work.
Hi @AtomFiske ,
In this case you just need to change the second argument of the division use the following metric:
Variation =
DIVIDE (
CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[YYYYMM] = MAX ( 'Table'[YYYYMM] ) )
- CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[YYYYMM] = MIN ( 'Table'[YYYYMM] ) ),
CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[YYYYMM] = MIN ( 'Table'[YYYYMM] ) )
)
If you want to present the values based on the YYYYMM also then you need to make some changes, this can be an option:
Variation =
IF(ISINSCOPE('Table'[YYYYMM]), SUM('Table'[Value]),
FORMAT(DIVIDE (
CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[YYYYMM] = MAX ( 'Table'[YYYYMM] ) )
- CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[YYYYMM] = MIN ( 'Table'[YYYYMM] ) ),
CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[YYYYMM] = MIN ( 'Table'[YYYYMM] ) )
), "#.00%"))
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @AtomFiske ,
Try the following code:
Variation =
DIVIDE (
CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[YYYYMM] = MAX ( 'Table'[YYYYMM] ) )
- CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[YYYYMM] = MIN ( 'Table'[YYYYMM] ) ),
CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[YYYYMM] = MAX ( 'Table'[YYYYMM] ) )
)
Be aware that this code only works if you do not have the yyyymm on your table, if you need to have it this needs to be revised.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsCovering 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 |
---|---|
101 | |
101 | |
87 | |
72 | |
67 |
User | Count |
---|---|
116 | |
109 | |
94 | |
79 | |
72 |