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
Roym
Helper IV
Helper IV

Slicer for multiple tables

I have report with a few different tables as shown in the below example. This works perfectly in my report but now I want to add slicer were you can choose a country and based on that selection the data for table 2/3/4 is shown for only that selected country.

 

What I first did is made the relationship between table1 and table 2 and 3. But when I want to make another relationship between table1 and table4 I get the error that this is not possible because this will create an ambiguity between two tables (I also have other relationships running between these tables.

 

Does anyone maybe have an idea how I can do this slicer without creating another relationship?

 

Table1

Countries
Netherlands
Greece

 

Table2

Issue nameCountry
Issue1Netherlands
Issue2Greece
Issue3Greece

 

Table3

Control nameCountry
Control1Netherlands
Control2Netherlands
Control3Greece

 

Table4

Process nameCountry
ProcessaNetherlands
processbGreece
processcNetherlands

 

Relationship made between Table1 country and table2 and table3 country.

1 ACCEPTED SOLUTION

@Roym See attached PBIX below signature.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

10 REPLIES 10
Greg_Deckler
Super User
Super User

@Roym So normally you would create a relationship to Table4 from Table1 and would be good to go. If the relationship ends up being inactive, you would use USERELATIONSHIP in a measure to get around that. You can have multiple paths but one will need to be inactive. You can also use TREATAS or DAX Table Hopping in a pinch. Force indirect relationship in dax? - Microsoft Power BI Community


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks. What I did now is create the relationship between table1 and table4, this one is inactive because of the ambiguity error. The only thing I'm not fully understand yet (based on the article) is the USERELATIONSHIP.  It is in the example used as a calculation. But my tables don't use a date/number. How do I need to build the USERELATIONSHIP in my case (so for the country)?

@Roym The exact answer is going to entirely depend on your desired outcome. What is the result that you are trying to achieve?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler I want to create a slicer with the countries in table1, and then all the other 3 tables should be filtered based on the selected country in the slicer

@Roym OK, could go the "Complex Selector" route. The Complex Selector - Microsoft Power BI Community

In your case for Table 4 you could do this:

Selector Measure = 
  VAR __Countries = SELECTCOLUMNS('Table1',"__Countries",[Countries])
  VAR __CurrentCountry = MAX('Table4'[Country])
RETURN
  IF(__CurrentCountry IN __Countries,1,0)

You use this measure to filter your Table4 visual.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler When trying this I noticed my original explanation was missing one part. In my original file there is also a relationship between table3 and table4 for the control name. Once I then try to create the next relationship this doesn't work. 

 

I created the measure you described but was unable to get this working (yet). I have attached the Pbix file with my current setup. Hopefully you are able to help. Thanks!!

 

Test.pbix 

@Roym That's a rather important detail...

Selector Measure = 
  VAR __Countries = SELECTCOLUMNS('Table1',"__Countries",[Countries])
  VAR __CurrentCountry = CALCULATE(MAX('Table4'[Country]),USERELATIONSHIP('Table1'[Countries],'Table4'[Country]))
RETURN
  IF(__CurrentCountry IN __Countries,1,0)

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler  yeah I indeed missed that important part 😞 sorry for that! I tried the code but didn't get it working (yet). 

 

Not sure if I put the measure in the right spot?

Capture.PNG

@Roym See attached PBIX below signature.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Great, thanks!!!! 

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.