Forum Discussion
Difference between two rows
Hi Team,
i have this function to calculate difference between rows:
QF Trade Ups2 =
VAR myindex=
selectedvalue('QF Core Pricing'[Fare Index - Text])
return
[MIN AIF QF]
-CALCULATE([MIN AIF QF],FILTER(ALL('QF Core Pricing'),VALUE('QF Core Pricing'[Fare Index - Text])=value(myindex)-1)
)
which leads to something weird:
Any idea why
12 Replies
- Greg_DecklerCommunity Champion
See my article on Mean Time Before Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/339586
Typically you would need to use EARLIER to achieve what you are going for.
- AnonymousNot applicable
Hi,
why should I use Earlier? I don't have a time comparison to achieve.
Sorry too long, don't have time.
- Greg_DecklerCommunity Champion
Read what you were doing too quickly. So, I assume that this is a measure. I would try MAX instead of SELECTEDVALUE. SELECTEDVALUE is typically used when dealing with a slicer. MAX of your Fare Index in the context of a row should return the value of the Fare Index in that row. Not sure what SELECTEDVALUE would return for something like that.
Sample source data would allow me to try different things out and be specific with a solution. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490