Forum Discussion
dsynan
8 years agoAdvocate III
Compare values based on two slicer selections - using only the locations where both selections match
I have one table. Would like to select two products from the table to compare some results (yield, profit, etc.), but only want the results for locations that have both products. 1. How to add s...
v-yulgu-msft
8 years agoMicrosoft Employee
Hi dsynan,
Suppose your source table is like:
Please create two extra tables which are unrelated to source table. Later, you should drag fields (Slicer1[Product] and Slicer2[Product]) from these two tables into two separate slicers.
Slicer1 = VALUES(Product_sales[Product]) Slicer2 = VALUES(Product_sales[Product])
Create below measures:
Sum product for slicer1 =
CALCULATE (
SUM ( Product_sales[Sales] ),
FILTER (
Product_sales,
Product_sales[Product] = LASTNONBLANK ( Slicer1[Product], 1 )
)
)
Sum product for slicer2 =
CALCULATE (
SUM ( Product_sales[Sales] ),
FILTER (
Product_sales,
Product_sales[Product] = LASTNONBLANK ( Slicer2[Product], 1 )
)
)
Isblank for slicer1 = IF([Sum product for slicer1]=BLANK(),0,1)
Isblank for slicer2 = IF([Sum product for slicer2]=BLANK(),0,1)
Add [Sum product for slicer1] and [Sum product for slicer1] to table visual. Add [Isblank for slicer1], [Isblank for slicer2] to "visual level filters", set their values to 1.
Best regards,
Yuliana Gu
Anonymous
3 years agoNot applicable
Hi Team
I need help in same where I want to add two more column in Slicer 1 and 2
Slicer1 = VALUES(Product_sales[Product]) Slicer2 = VALUES(Product_sales[Product])
And then I slice the value as per category and sub category
I want add two more columns here
Like this and then I can select value as per category and sub category
What will be Dax below
Sum product for slicer1 =
CALCULATE (
SUM ( Product_sales[Sales] ),
FILTER (
Product_sales,
Product_sales[Product] = LASTNONBLANK ( Slicer1[Product], 1 )
)
)
Sum product for slicer2 =
CALCULATE (
SUM ( Product_sales[Sales] ),
FILTER (
Product_sales,
Product_sales[Product] = LASTNONBLANK ( Slicer2[Product], 1 )
)
)
Isblank for slicer1 = IF([Sum product for slicer1]=BLANK(),0,1)
Isblank for slicer2 = IF([Sum product for slicer2]=BLANK(),0,1)