Forum Discussion
SeGr
3 years agoHelper I
using field parameters as a value in TopN
Hi team, I am using Field Parameters to switch between measures in a stacked chart. One requirement that I have is to calculate TopN. My issue is that the field parameters cannot be used as a v...
- 3 years ago
I was able to accomplish this by using
switch
(selectedvalue (measure parameter order),
0, [ measure 1 ],
1, [ measure 2 ],
etc
)
Anonymous
3 years agoNot applicable
You have to create a new measure. I could solve the problem by creating the measure like this:
Measure = SWITCH(SELECTEDVALUE(ParameterTable[Parameter Order]),
0, [Measure1],
1, [Measure2]
)
Note: You have to use the order of the parameter ([Parameter Order]) as the argument of SELECTEDVALUE function, to use the index (0, 1, 2, ...) of the parameter in SWITH function.
For example, if you have a parameter like this:
CostRevenue = {
("Cost", NAMEOF('Sales'[CostSum]), 0),
("Revenue", NAMEOF('Sales'[RevenueSum]), 1)
}
The Measure you have to create and use as TopN filter will be:
CostRevenueForTopN = SWITCH(SELECTEDVALUE(CostRevenue[CostRevenue Order]),
0, 'Sales'[CostSum],
1, 'Sales'[RevenueSum]
)
Thanks!
- ixnayonthetimma2 years agoRegular Visitor
Thanks for your reply, it helped me with an issue of selecting TopN by parameters that applied to many different visuals!