Forum Discussion
Field Parameters and TopN not working
- 4 years ago
Ok was able to fix it with (for me in this case) a TopN slider and Parameter field.
Had 2 fields, so made 2 ranking fields and combined with the ranking slider I made, made this rankfilter.
RankFilter = IF([Rank] <= RankSlider[RankSlider Value] && [Rank2] <= RankSlider[RankSlider Value] ,1,0)So for the visual put that one in the filter and now it works like a charm.Whatever breakdown from the field parameter I choose rank or rank2 will be active and for both I will get my TopN.
rpinxt , Refer to my example. I have two Axis columns Brand and Category
Created a field parameter
Parameter = {
("Brand", NAMEOF('Item'[Brand]), 0),
("Category", NAMEOF('Item'[Category]), 1)
}
Then created 2 measures
TOP2 Brand = CALCULATE([Net], TOPN(2,ALLSELECTED('Item'[Brand]), [Net],DESC), values('Item'[Brand]))
TOP2 Category = CALCULATE([Net], TOPN(2,ALLSELECTED('Item'[Category]), [Net],DESC), values('Item'[Category]))
The created selected parameter measure
Selected Parameter = maxx(filter(Parameter ,Parameter[Parameter Order] = SELECTEDVALUE(Parameter[Parameter Order])), Parameter[Parameter])
Final topn
TOP N = SWITCH([Selected Parameter], "Brand" ,[TOP2 Brand], [TOP2 Category])