The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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?
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
22 | |
20 | |
19 | |
18 | |
13 |
User | Count |
---|---|
41 | |
38 | |
24 | |
22 | |
20 |