Forum Discussion
Filter TOPN by dynamic values
- 4 years ago
Hi superBro22 ,
1 You need a slicer for user to select A or B, so create a table for slicer via AorB = {"A","B"}. Then create a measure like the this:
Measure = VAR _s = SELECTEDVALUE ( AorB[Value] ) VAR _A = SUM ( 'Table'[ValueA] ) VAR _B = SUM ( 'Table'[ValueB] ) RETURN IF ( _s = "A", _A, _B )Result:
2 You can use the date hierarchy. Then use slicer to slicer which month you want.
If you want to keep the total of this year , you can use hasonevalue() to distinguish if it is total row.
all year = IF ( HASONEVALUE ( Facttable[Date].[Month] ), SUM ( Facttable[values] ), CALCULATE ( SUM ( Facttable[values] ), ALLEXCEPT ( Facttable, Facttable[Date].[Year] ) ) )Pbix in the end you can refer.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi superBro22 ,
1 You need a slicer for user to select A or B, so create a table for slicer via AorB = {"A","B"}. Then create a measure like the this:
Measure =
VAR _s =
SELECTEDVALUE ( AorB[Value] )
VAR _A =
SUM ( 'Table'[ValueA] )
VAR _B =
SUM ( 'Table'[ValueB] )
RETURN
IF ( _s = "A", _A, _B )
Result:
2 You can use the date hierarchy. Then use slicer to slicer which month you want.
If you want to keep the total of this year , you can use hasonevalue() to distinguish if it is total row.
all year =
IF (
HASONEVALUE ( Facttable[Date].[Month] ),
SUM ( Facttable[values] ),
CALCULATE (
SUM ( Facttable[values] ),
ALLEXCEPT ( Facttable, Facttable[Date].[Year] )
)
)
Pbix in the end you can refer.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.