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 data like this-
Id | Stage | Day | StageNO |
6g00003 | stage 6 | 244 | 6 |
6g00003 | stage 5 | 5 | |
6g00003 | stage 4 | 21 | 4 |
6g00003 | stage 3 | 3 | |
6g00003 | stage 2 | 2 | |
6g00003 | stage 1 | 1 |
NB: Each ID has 4 stages. Every time an id will first enter stage 6, and the 5,4,3,..1. and how many days they are staying in that stage is showing on the Day column. Here this id was in stage 6 for 244 days. It was in stage 5 but we have no data for that. Then it goes to stage 4 and stays for 21 days. this is his current stage as we don't have any future value for this ID.
I want a cumulated column that will show the cumulative day count but like this -
Here, as the current stage is 4, the cumulative value for stage 5 is shown as the previous value. But after stage 4, it does not have any value in future stages. So it would be blank.
Can anyone help me with that?
Hi did you find the solution?
I came up with same issue
Hello @Jihwan_Kim
I think you understood what I meant but It gave me blank values when I applied this to my table.
Hi,
If you are looking for creating a new calculated column, please check the below picture and the attached pbix file.
Cumulative days measure CC: =
VAR _minstage =
MINX ( FILTER ( Data, Data[Day] <> BLANK () ), Data[StageNO] )
RETURN
IF (
Data[StageNO] >= _minstage,
CALCULATE (
SUM ( Data[Day] ),
WINDOW (
1,
ABS,
0,
REL,
SUMMARIZE ( ALL ( Data ), Data[Id], Data[Stage], Data[StageNO], Data[Day] ),
ORDERBY ( Data[StageNO], DESC, Data[Stage], DESC ),
KEEP,
PARTITIONBY ( Data[Id] )
)
)
)
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.
Hello, @Jihwan_Kim Thank you for your response. But It does not work on mine either way. It does not show value for stage 4. I mean where there is no value for Day. Also, it is not being cumulated.
I have found another way to do that. For that I needed another column Current_stage. I thought it would be doable easily without it.
I used that in my calculation which gave me my the desired output. But if you have solution without using that column I will appreciated that too.
Hi,
I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.
It is for creating a new measure.
Cumulative days measure: =
VAR _minstage =
CALCULATE (
MIN ( Data[StageNO] ),
FILTER ( ALL ( Data ), Data[Day] <> BLANK () )
)
RETURN
IF (
MAX ( Data[StageNO] ) >= _minstage
&& HASONEVALUE ( Data[StageNO] ),
CALCULATE (
SUM ( Data[Day] ),
WINDOW (
1,
ABS,
0,
REL,
SUMMARIZE ( ALL ( Data ), Data[Id], Data[Stage], Data[StageNO], Data[Day] ),
ORDERBY ( Data[StageNO], DESC, Data[Stage], DESC ),
KEEP,
PARTITIONBY ( Data[Id] )
)
)
)
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.
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 |
---|---|
96 | |
94 | |
82 | |
70 | |
64 |
User | Count |
---|---|
116 | |
106 | |
94 | |
79 | |
72 |