Forum Discussion
Comparing Values with Offset?
- Anonymous3 years ago
Hi TotunG ,
Here are the steps you can follow:
1. You reposition the two columns of the Period Ref table, with [Period Ref] first and [Period Name] last.
2. Create calculated column.
Table 2 = var _table1= SUMMARIZE( 'Table','Table'[Period Ref], "Period Name", "P_Total") return UNION( 'Table',_table1)3. Combine the relationship between two tables.
4. Create measure.
Flag= IF( MAX('Table 2'[Period Ref]) in SELECTCOLUMNS('MainData',"1",[Period]) && MAX('Table 2'[Period Name]) <> "P_Total", [Total Value],[Dynamic DIfference])5. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi TotunG ,
I created some data:
Here are the steps you can follow:
1. Create measure.
Measure =
var _select=
SELECTCOLUMNS('Table',"1",[Week_Slicer])
var _maxx=
MAXX(
FILTER(ALL('Table'),'Table'[Week_Slicer] in _select),[Week])
var _secondlargest=
MAXX(
FILTER(ALL('Table'),'Table'[Week_Slicer] in _select&&'Table'[Week]<_maxx),[Week])
return
SUMX(
FILTER(ALL('Table'),'Table'[Week]=_maxx),[Value])
-
SUMX(
FILTER(ALL('Table'),'Table'[Week]=_secondlargest),[Value])
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Thank you - would this still work if Week table is different from the Data table but connected with a relationship and the value being filtered is a measure?