Forum Discussion
Anonymous
3 years agoNot applicable
Previous value + 1 with Criteria
Hi Everyone!
A couple of days ago, I asked help to pull the previous value of a row, I was helped here.
Now, I have this code, which returns 1 if the actual value is equal to the previous value, and 0 if doesn't.
Congelamento =
VAR EarlierEntryOfNomeDeOrigem =
CALCULATE(
MAX(fminuto[Timestamp]),
FILTER(
ALL(fminuto),
fminuto[Nome da Origem]=SELECTEDVALUE(fminuto[Nome da Origem])
&& fminuto[Timestamp]<MAX(fminuto[Timestamp])
)
)
VAR EarlierEntryOfVazao = CALCULATE(
SELECTEDVALUE(fminuto[Vazão],"no value"),
FILTER(
ALL(fminuto),
fminuto[Nome da Origem]=SELECTEDVALUE(fminuto[Nome da Origem])
&& fminuto[Timestamp] = EarlierEntryOfNomeDeOrigem
)
)
RETURN
IF(EarlierEntryOfVazao=SELECTEDVALUE(fminuto[Vazão], "no value"), 1, 0)
I would like to, not only show a binary, like 1, but to SUM the previous row with +1 everytime the values are equal, until the sequence is broken by a 0, for example: "0, 1, 2, 3, 4, 5, 6, 7, 0". The objective here is to know how much time the value stayed frozen in sequence. Could anyone help me with this, please?
IF(EarlierEntryOfVazao=SELECTEDVALUE(fminuto[Vazão], "no value"), 1, 0)
I would like to, not only show a binary, like 1, but to SUM the previous row with +1 everytime the values are equal, until the sequence is broken by a 0, for example: "0, 1, 2, 3, 4, 5, 6, 7, 0". The objective here is to know how much time the value stayed frozen in sequence. Could anyone help me with this, please?
1 Reply
- lbendlin
Super User
Please provide sanitized sample data that fully covers your issue.
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
Please show the expected outcome based on the sample data you provided.
https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523