Forum Discussion
Anonymous
6 years agoNot applicable
Top N using multiple slicers
Hi, I need to rank performance of products using multiple slicers. For example, selecting top N products selling well in October 2020. The slicers here are Date and Top N. Please could someon...
v-xicai
6 years agoCommunity Support
Hi Anonymous ,
You may create new calculated table, rename the result column with "TopN", use the column 'TopN'[TopN] as the source of slicer.
TopN= GENERATESERIES(0, 10, 1)
Then you may create measure like DAX below.
TopN Value =
VAR _SelectedTop =
SELECTEDVALUE ( 'TopN'[TopN] )
RETURN
SWITCH (
TRUE (),
SelectedTop = 0, [Value],
RANKX ( ALLSELECTED ( Table1 ), [Value] ) <= _SelectedTop, [Value]
)
Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
6 years agoNot applicable
Hi v-xicai ,
I couldn't call [Value] after selectedTop= 0. Is it because [Value] should be a measure rather than a column?
- Anonymous6 years agoNot applicable
- v-xicai6 years agoCommunity Support
Hi Anonymous ,
If the [Value] is a column, you may change the formula like DAX below.
TopN Value = VAR _SelectedTop = SELECTEDVALUE ( 'TopN'[TopN] ) RETURN SWITCH ( TRUE (), SelectedTop = 0, SUM ( [Value] ), RANKX ( ALLSELECTED ( Table1 ), [Value] ) <= _SelectedTop, SUM ( [Value] ) )Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.