Forum Discussion
alsm
Helper III
3 years agoCreating a slicer with others category
Hello,
I wish to create a slicer for currencies in my data. I wish some of the currencies to be listed explicitly e.g. (USD, GPB, CAD, CHF,...) and other currencies (e.g. MXN, RUB, CNY...) to be in 'Other' category and all the calculations are performed accordingly i.e. Sales with USD selected has total sales volume with ccy = USD where as when user selects 'Other' it is total sales of all the currencies in Other category.
Which would be the most ideal way to go about it?
ok, figured it out ...
steps involved
- Create a table with distinct currencys in the table
- Then add a new column with a switch statement where one adds 'Others'
- Create a relationship with the original table for the filter to work
DAX code
Ccy List =ADDCOLUMNS (DISTINCT ( DataTable[Positions.Currency] ),"Currency Group",SWITCH (TRUE (),[Positions.Currency] = "CHF", "CHF",[Positions.Currency] = "USD", "USD",[Positions.Currency] = "EUR", "EUR","Others"))
1 Reply
- alsm
Helper III
ok, figured it out ...
steps involved
- Create a table with distinct currencys in the table
- Then add a new column with a switch statement where one adds 'Others'
- Create a relationship with the original table for the filter to work
DAX code
Ccy List =ADDCOLUMNS (DISTINCT ( DataTable[Positions.Currency] ),"Currency Group",SWITCH (TRUE (),[Positions.Currency] = "CHF", "CHF",[Positions.Currency] = "USD", "USD",[Positions.Currency] = "EUR", "EUR","Others"))