Forum Discussion
Anonymous
7 years agoNot applicable
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...
Anonymous
7 years agoNot applicable
Hi Frank,
mmm I believe we have to include more variables. This is what I got
Trade Up =
VAR index = max('QF Core Pricing'[Fare Index])
return
if(
index = 1,
0,
calculate(sum('QF Core Pricing'[AIF]))-
calculate(sum('QF Core Pricing'[AIF]),FILTER(ALL('QF Core Pricing'),'QF Core Pricing'[Fare Index]= index-1)
)
)Columns Market and restriction are relevant. It looks like this measure is just doing it for the whole query.
What if we make it as a column?
v-frfei-msft
7 years agoCommunity Support
Hi Anonymous,
To create a calculated column as below.
Column = var index = CALCULATE(MAX(Table1[Index ])) return IF(index=1,0,Table1[AIF] -CALCULATE(SUM(Table1[AIF]),FILTER(Table1,Table1[Index ]=index-1)))
Regards,
Frank
- Anonymous7 years agoNot applicable
No Luck again:
Trade Up = var index=Calculate(MAX('QF Core Pricing'[Fare Index])) return if(index=1,0,'QF Core Pricing'[AIF]-calculate(sum('QF Core Pricing'[AIF]),Filter('QF Core Pricing','QF Core Pricing'[Fare Index]=index-1)))could it be that it needs a filter for the market and restriction columns in order to work?
- v-frfei-msft7 years agoCommunity Support
Hi Anonymous,
Is that possbile to share your pbix to me? You can upload the file to dropbox and share the link to me.
Regards,
Frank
- Anonymous7 years agoNot applicable
Hi Frank,
use this one, where sensible data has been removed:
https://www.dropbox.com/s/r7pdon0duhtm55s/Fare%20Grids%20-%20msft.pbix?dl=0
let me know if doesn't work.
cheers
Alberto