Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Brotedo
Helper I
Helper I

Two Slicers on Same Column, Measures Based on Those Values

I have a simple single table dataset which has columns for Customer, Product, and Sales. I want to compare customers head to head based on sales for different products.

What I've tried so far: I duplicated the Name column twice (to form Name1 and Name2), and have a slicer based on each that are set to ignore each other. 

I'm struggling to create measures to sum sales based on those slicers. This is what I tried:

SalesPick1 = if(HASONEVALUE('Table'[Name1]), CALCULATE(sum('Table'[Sales]), REMOVEFILTERS('Table'[Name2])))
SalesPick2 = if(HASONEVALUE('Table'[Name2]), CALCULATE(sum('Table'[Sales]), REMOVEFILTERS('Table'[Name1])))

Then I have a matrix with rows based on Product, and two value columns, Salespick1 and Salespick2. If I select a name from one of the slicers and leave the other blank, the columns work. If I select different values for the two slicers, I get no data in my matrix.

I want this:

Product        Sales for Pick1        Sales for Pick2

A                   x1                           y1

B                   x2                           y2

C                   x3                           y3

 

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Brotedo 

these two columns should be two single column tables. Create inactive relationship between each of these tables with the original column in the original table. Then you can use CALCULATE with USERELATIONSHIP to activate the desired relationship for each measure or variable. 

View solution in original post

1 REPLY 1
tamerj1
Super User
Super User

Hi @Brotedo 

these two columns should be two single column tables. Create inactive relationship between each of these tables with the original column in the original table. Then you can use CALCULATE with USERELATIONSHIP to activate the desired relationship for each measure or variable. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors