Forum Discussion
Find the previous action
Hello,
In power bi, I would like a column calculated in dax which puts a 1 on the last action which precedes the auto-close action of the same ID.
The table is called Journal, the time column is time, the column where we find the auto-close is called action.
I put an example of what I want.
Can you help me ?
THANKS
17 Replies
- AnonymousNot applicable
Hi MathieuF ,
Please try,Auto-close = VAR _close_time = CALCULATE(MAX('Table'[Time]),'Table'[action]="auto-close",ALLEXCEPT('Table','Table'[ID])) VAR _result =IF('Table'[Time]=CALCULATE(MAX('Table'[Time]),'Table'[Time]<_close_time),1) RETURN _resultBest Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
- MathieuFHelper III
Good morning,
Let me come back to you because I'm still stuck.
I am looking to put the name of the agent in the column created in front of the line Journal[action]=auto-close which follows the line where I have the agent for the same task_id.
https://drive.google.com/file/d/1j-P7F-Prw_5y-3QmV8WzE8GdApm1X5NX/view?usp=drive_linkThank you
- MathieuFHelper III
Good morning,
With the formula below, how to display only one 1; the one just after the auto-close?
Can anyone help me?`Auto-close2 =
VAR _close_time = CALCULATE(MAX('journal'[created_at]),'journal'[action]="auto-close",ALLEXCEPT('journal','journal'[task_id]))VAR _result =IF('journal'[created_at]=CALCULATE(MAX('journal'[created_at]),'journal'[created_at]<_close_time,ALLEXCEPT('journal','journal'[task_id])),1)RETURN_result`
Thanks in advance.
Anonymous