Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi everyone!
I need to check if my previous status is different from my current one. However, the initial comparison to proceed with my code does not return what I want.
In image formula, MAX returns the highest value of the status evaluated in the dates before my current line, however I just want the occurrence immediately before.
Also, because it's text: inativo > ativo
Expected result:
Sem histórico
Ativo
Ativo
Ativo
Inativo
Sem histórico
Ativo
Inativo
Ativo
Ativo
Sem histórico
Inativo
Ativo
Inativo
Ativo
Can someone help me?
Solved! Go to Solution.
Hey @speedramps!
Thanks for your answer!
I wanted to compare the "Status" column of the most recent date with the "Status" of the previous most recent date for a sku.
I solved the problem as follows:
Hey @speedramps!
Thanks for your answer!
I wanted to compare the "Status" column of the most recent date with the "Status" of the previous most recent date for a sku.
I solved the problem as follows:
Please can you explain more clearly what you want so we can help. Thanks.
1) Do you want to compare the most recent date with the previous most recent date for a sku?
2) Or do you want to compare the last row wtth previous row for each sku
Option 1 answer ....
Current status =
VAR mylastdate = CALCUALTE( MAX(Planline[date], ALLEXCEPT(Planline[sku])
RETURN
CALCULATE(
SELECTVALUE( Planline[status],"More than one status per day"),
ALLEXCEPT(Planline[sku]),
Planline[date] = mylastdate)
Previous status =
VAR mylastdate = CALCUALTE( MAX(Planline[date], ALLEXCEPT(Planline[sku])
VAR mypreviousdate =
CALCUALTE( MAX(Planline[date],
ALLEXCEPT(Planline[sku]),
Planline[date] < mylastdate)
RETURN
CALCULATE(
SELECTVALUE( Planline[status],"More than one status per day"),
ALLEXCEPT(Planline[sku]),
Planline[date] = mypreviousdate)
Option 2
same as above except use an index instead of a date
Please click thumbs up and accept as solution
User | Count |
---|---|
17 | |
14 | |
14 | |
13 | |
12 |
User | Count |
---|---|
19 | |
15 | |
15 | |
11 | |
10 |