March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
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
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 =
Thanks in advance.
@v-cgao-msft
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_link
Thank you
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
_result
Best Regards,
Gao
Community Support Team
If 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
Hello @v-cgao-msft ,
Thanks a lot for your help.
Is it possible to have a 1 just on the action which precedes and not all the actions which precede.
THANKS
Hi @MathieuF ,
Please consider providing a sample file that can cover the question and give the expected output. Note that it should not contain private data.
How to provide sample data in the Power BI Forum - Microsoft Fabric Community
Best Regards,
Gao
Community Support Team
If 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
Hello, here is an example of data : https://drive.google.com/file/d/1L4y2fVMP6UoilrKO5vpiCTTV5z-80D3i/view?usp=share_link
Thanks
Hi @MathieuF ,
It seems that the key [action] field is missing from the data.
Please try:
Column =
VAR _close_time = CALCULATE(MAX('Table'[created_at]),'Table'[action]="auto-close",ALLEXCEPT('Table','Table'[ID]))
VAR _result =IF('Table'[created_at]=CALCULATE(MAX('Table'[created_at]),'Table'[created_at]<_close_time,ALLEXCEPT('Table','Table'[ID])),1)
RETURN
_result
Best Regards,
Gao
Community Support Team
If 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
Thank you for your help, unfortunately, I have an error message:
It is not possible to determine a unique value for the "created_at" column of the "Journal" table. This can happen when a measure formula refers to a column that contains many values, without specifying an aggregation such as min, max, count, or sum to get a single result.
So I changed the query to
Auto-close =
VAR _close_time = CALCULATE(MAX('Journal'[created_at]),'Journal'[action]="auto-close",ALLEXCEPT('Journal','Journal'[id]))
VAR _result =IF(MAX('journal'[created_at])=CALCULATE(MAX('Journal'[created_at]),'Journal'[created_at]<_close_time,ALLEXCEPT('Journal','Journal'[id])),1)
RETURN
_result
is it good ?
Because I have no result 😞
hi @MathieuF
try to add a calculated column like:
Column =
VAR _LastTime=
MAXX(
FILTER(
data,
data[name]=EARLIER(data[name])
&&data[action]<>"auto-close"
),
data[time]
)
RETURN
IF(
[Time]=_LastTime,
1
)
it worked like:
Hello @FreemanZ ,
hi @MathieuF
you know your dataset best. please feel free to change name to id.
The results are not good.
I am currently having a problem accessing the table.
When I have new access, I will see what is causing the problem.
Small question, should the table be sorted?
Hello @FreemanZ
I'll screenshot the problem for you.
I will privately send you the model with the data.
Is it related to the sorting of updated-at?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
25 | |
18 | |
15 | |
9 | |
8 |
User | Count |
---|---|
37 | |
32 | |
18 | |
16 | |
13 |