Forum Discussion
bizbi
Advocate I
8 years agoHow to get data for 2 columns using different slicers for each column in a table?
Table/Output needed: There is a single column for Category in the dataset. Similarly, there is a single column for Month. The need is to use two slicers (one for base month and the other co...
- 8 years ago
Hi bizbi,
Suppose the data table is called 'Table1'. First, you need two extra tables that are unrelated to 'Table1', to provide the list of Months.
Table for slicer1 = VALUES(Table1[Month]) Table for slicer2 = VALUES(Table1[Month])
Then, create below measures. Now that you want two slicers, you should drag month columns from two separate tables ('Table for slicer1' and 'Table for slicer2') into two slicers.
Slicer1 selection = LASTNONBLANK('Table for slicer1'[Month],1) Slicer2 selection = LASTNONBLANK('Table for slicer2'[Month],1) Base Month data = CALCULATE(SUM(Table1[Value]),FILTER(Table1,Table1[Month]=[Slicer1 selection])) Comparison Month data = CALCULATE(SUM(Table1[Value]),FILTER(Table1,Table1[Month]=[Slicer2 selection])) Trend = [Base Month data]-[Comparison Month data]Best regards,
Yuliana Gu
v-yulgu-msft
Microsoft Employee
8 years agoHi bizbi,
Suppose the data table is called 'Table1'. First, you need two extra tables that are unrelated to 'Table1', to provide the list of Months.
Table for slicer1 = VALUES(Table1[Month]) Table for slicer2 = VALUES(Table1[Month])
Then, create below measures. Now that you want two slicers, you should drag month columns from two separate tables ('Table for slicer1' and 'Table for slicer2') into two slicers.
Slicer1 selection = LASTNONBLANK('Table for slicer1'[Month],1)
Slicer2 selection = LASTNONBLANK('Table for slicer2'[Month],1)
Base Month data = CALCULATE(SUM(Table1[Value]),FILTER(Table1,Table1[Month]=[Slicer1 selection]))
Comparison Month data = CALCULATE(SUM(Table1[Value]),FILTER(Table1,Table1[Month]=[Slicer2 selection]))
Trend = [Base Month data]-[Comparison Month data]
Best regards,
Yuliana Gu