Forum Discussion
Difference between two columns selected by slicer in matrix
Hi all,
new to Power BI and having some issues with matrix visualisation
The requirement is that the user can choose 2 marketing campaigns via a slicer (or slicers) and display metrics for each campaign in a matrix like below.
Campaign A Campaign B Delta
metric a . 12 . 6 6
metric b . 3 . 4 -1
metric c . 2 2 0
- Is it possible to have separate slicers with each slicer linked to it's own column in the matrix? Using a multi select slicer will allow the user to select more than 2 campaigns which they don't want.
- How do I do a delta column based on what is selected in the slicer or slicers?
Thanks
Keith
Hi Anonymous
There are some workarounds:
As tested, we can create two seperate tables which have no relationship with your table.
slicer1 = VALUES(Sheet6[Campaign]) slicer2 = VALUES(Sheet6[Campaign])Then create measures in your table
Measure = VAR r_v = CALCULATE ( SUM ( Sheet6[value] ), FILTER ( Sheet6, Sheet6[Campaign] = SELECTEDVALUE ( slicer1[Campaign] ) || Sheet6[Campaign] = SELECTEDVALUE ( slicer2[Campaign] ) ) ) RETURN IF ( HASONEVALUE ( Sheet6[Campaign] ), r_v, CALCULATE ( SUM ( Sheet6[value] ), FILTER ( Sheet6, Sheet6[Campaign] = SELECTEDVALUE ( slicer1[Campaign] ) ) ) - CALCULATE ( SUM ( Sheet6[value] ), FILTER ( Sheet6, Sheet6[Campaign] = SELECTEDVALUE ( slicer2[Campaign] ) ) ) )or create three measures and add them in the matrix
company1 = CALCULATE(SUM(Sheet6[value]),FILTER(Sheet6,Sheet6[Campaign]=SELECTEDVALUE(slicer1[Campaign]))) company2 = CALCULATE(SUM(Sheet6[value]),FILTER(Sheet6,Sheet6[Campaign]=SELECTEDVALUE(slicer2[Campaign]))) delta = [company1]-[company2]Best Regards
MaggieCommunity Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
7 Replies
- v-juanli-msft
Community Support
Hi Anonymous
There are some workarounds:
As tested, we can create two seperate tables which have no relationship with your table.
slicer1 = VALUES(Sheet6[Campaign]) slicer2 = VALUES(Sheet6[Campaign])Then create measures in your table
Measure = VAR r_v = CALCULATE ( SUM ( Sheet6[value] ), FILTER ( Sheet6, Sheet6[Campaign] = SELECTEDVALUE ( slicer1[Campaign] ) || Sheet6[Campaign] = SELECTEDVALUE ( slicer2[Campaign] ) ) ) RETURN IF ( HASONEVALUE ( Sheet6[Campaign] ), r_v, CALCULATE ( SUM ( Sheet6[value] ), FILTER ( Sheet6, Sheet6[Campaign] = SELECTEDVALUE ( slicer1[Campaign] ) ) ) - CALCULATE ( SUM ( Sheet6[value] ), FILTER ( Sheet6, Sheet6[Campaign] = SELECTEDVALUE ( slicer2[Campaign] ) ) ) )or create three measures and add them in the matrix
company1 = CALCULATE(SUM(Sheet6[value]),FILTER(Sheet6,Sheet6[Campaign]=SELECTEDVALUE(slicer1[Campaign]))) company2 = CALCULATE(SUM(Sheet6[value]),FILTER(Sheet6,Sheet6[Campaign]=SELECTEDVALUE(slicer2[Campaign]))) delta = [company1]-[company2]Best Regards
MaggieCommunity Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.- AnonymousNot applicable
Hi v-juanli-msft ,
thanks for the reply and it looks like it should solve my issue. I'm very new to power bi and tried to use your example but I can't seem to get it working for my use case. I've attached my pbix file with a table and two disconnected slicers. If you could have a quick look and show me what I need to do, it would be much appreciated.
Cheers
Keith
- v-juanli-msft
Community Support
Hi Anonymous
Does the real data for 'Unique Clicks" or "Unique Opens" table only have three columns?
if so, we can merge two tables together, would you mind merging the two tables in Power query or merge 'Unique Clicks" and "Unique Opens", "Sent" tables together?
Best Regards
Maggie
- amitchandak
Super User
Try to restrict max selected values. No direct solution. But refer
https://community.powerbi.com/t5/Desktop/Restrict-Slicer-selection-count-to-2/td-p/308684
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.
My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601- AnonymousNot applicable
Thanks amitchandak , that helps with the first of my issues.