Forum Discussion
Anonymous
9 years agoNot applicable
Slicer by columns name
Hello, I have the following table: Sale_ID Unity_Price Tax_1 Tax_2 Tax_3 Tax_4 1 10 5 15 8 4 2 40 30 25 8 7 To calculate the final price of a sale I created a...
- 9 years ago
Hi Anonymous,
I would solve this using a measure do the following:
- Create a table (do not related this with any other tables with the following structure:
- Name Slicer - Selection: Unity_Price, Tax_1, Tax_2, Tax_3, Tax_4
- Add the following measure to your data table:
Final_Price = VAR Unity_price = IF ( CONTAINS ( Slicer, Slicer[Selection], "Unity_Price" ) = TRUE (), SUM ( Sales[Unity_Price] ), 0 ) VAR Tax1 = IF ( CONTAINS ( Slicer, Slicer[Selection], "Tax_1" ) = TRUE (), SUM ( Sales[Tax_1] ), 0 ) VAR Tax2 = IF ( CONTAINS ( Slicer, Slicer[Selection], "Tax_2" ) = TRUE (), SUM ( Sales[Tax_2] ), 0 ) VAR Tax3 = IF ( CONTAINS ( Slicer, Slicer[Selection], "Tax_3" ) = TRUE (), SUM ( Sales[Tax_3] ), 0 ) VAR Tax4 = IF ( CONTAINS ( Slicer, Slicer[Selection], "Tax_4" ) = TRUE (), SUM ( Sales[Tax_4] ), 0 ) RETURN Unity_price + Tax1 + Tax2 - Tax3 - Tax4- Now just add the valuies from the table you created to a slicer and your measure to the table should give the expected result:
Regards,
MFelix
- Create a table (do not related this with any other tables with the following structure:
Anonymous
3 years agoNot applicable
I saw your post and wonder if you could help me as well 😁
I am also trying to create a category slicer based on the Column name, each category(product) has 3 sub-columns, and they are the same product.
Like, Volumn, MS, Rank, all same 3 columns for each product AAA, BBB, CCC.
I want to create a slicer to filter on the product name AAA, BBB, CCC, so that each time when the user click on each product, together with other row slicer (like period in this example), a different table will appear.
Thanks in advance!!!
| Customer Name | Period | AAA-Volumn | AAA-MS | AAA-Rank | BBB-Volumn | BBB-MS | BBB-Rank | CCC-Volumn | CCC-MS | CCC-Rank |
| Smith | Month | 2 | 10% | 3 | 1 | 2% | 2 | 4 | 2% | 2 |
| John | Month | 3 | 20% | 2 | 2 | 3% | 3 | 2 | 3% | 2 |
| Albert | Month | 4 | 30% | 1 | 3 | 4% | 1 | 3 | 30% | 3 |
| April | Month | 5 | 10% | 3 | 4 | 5% | 2 | 2 | 23% | 3 |
| Smith | QTR | 4 | 30% | 3 | 3 | 2% | 1 | 1 | 5% | 1 |
| John | QTR | 5 | 20% | 2 | 2 | 3% | 3 | 2 | 20% | 3 |
| Albert | QTR | 1 | 20% | 1 | 1 | 1% | 2 | 3 | 34% | 2 |
| April | QTR | 4 | 10% | 3 | 1 | 2% | 4 | 4 | 5% | 4 |
| Smith | YTD | 5 | 10% | 3 | 5 | 5% | 2 | 2 | 2% | 3 |
| John | YTD | 7 | 20% | 2 | 2 | 4% | 1 | 3 | 20% | 1 |
| Albert | YTD | 2 | 30% | 1 | 3 | 5% | 3 | 2 | 3% | 2 |
| April | YTD | 2 | 10% | 3 | 1 | 3% | 1 | 1 | 10% | 3 |
| Category Slicer | Customer Name | AAA-Volumn | AAA-MS | AAA-Rank | |
| AAA | Smith | 2 | 10% | 3 | |
| BBB | John | 3 | 20% | 2 | |
| CCC | Albert | 4 | 30% | 1 | |
| April | 5 | 10% | 3 | ||
| Period Slicer | |||||
| Month |
|