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.
Hello everyone,
I am new to Power BI and need help to create a new calculated column with DAX. I have this below-mentioned table where status or success columns represent process is finished successfully or not. (1 or F means finished successfully otherwise not), process_time_in_minutes column represents the duration of the process.
id | status | success | process_time_in_minutes |
1 | F | 1 | 80 |
2 | L | 0 | 70 |
3 | L | 0 | 30 |
4 | F | 1 | 60 |
5 | L | 0 | 50 |
6 | F | 1 | 34 |
I need a new table like the below one. I want to get total values for a successful process, so if the process has failed then process duration should be kept adding until it gets successful
What I actually want is if the process finished successfully means success = 1 then process time is the same for the next column, otherwise, if it is failed then it should add all previous values till success =1, for first failed process it will be same value as there is no previous failed, but for next ones, it should be kept adding until process finished successfully.
id | status | success | process_time_in_minutes | updated_process_time_in_minutes |
1 | F | 1 | 80 | 80 |
2 | L | 0 | 70 | 70 |
3 | L | 0 | 30 | 100 |
4 | F | 1 | 60 | 160 |
5 | L | 0 | 50 | 50 |
6 | F | 1 | 34 | 84 |
Please help me to write a DAX query for this. Thanks!
Solved! Go to Solution.
@Anonymous
pls try this
Proud to be a Super User!
@Anonymous
you can try to create a column
Column =
VAR _LAST=maxx(FILTER('Table','Table'[id]<EARLIER('Table'[id])&&'Table'[status]="F"),'Table'[id])
return sumx(FILTER('Table','Table'[id]>_LAST&&'Table'[id]<=EARLIER('Table'[id])),'Table'[process_time_in_minutes])
Proud to be a Super User!
I just tried your query but got an empty column.
@Anonymous
pls try this
Proud to be a Super User!
Thank you so much, I just missed renaming that too.
Could you please also explain the query? would be really helpful to understand.
@Anonymous
find the last success record, then add up all time from one after last success record until the current record.
Proud to be a Super User!
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 |
---|---|
112 | |
100 | |
80 | |
64 | |
57 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |