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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Deevo_
Resolver I
Resolver I

Create a Slicer using 2 columns from 2 different tables and Use both columns in the slicer hierarchy

Hi all, many thanks in advance.

I have used this post to complete 50% of what I need for my report. 

https://community.fabric.microsoft.com/t5/Desktop/Create-two-slicers-from-two-different-name-fields-...

I need help with DAX. Instead of having one column in my slicer from one table, I require 2 columns that have been unioned from 2 different tables because each table has a different meaning. The two columns will be used as a hierarchy in the slicer to allow the user to select either the top OR select the lower level values.

My progress so far:

Step 1: create the slicer using a union and summarize to bring in 2 columuns [Division] and [Branch]. This step works fine.

Slicer =
DISTINCT(
        UNION(SUMMARIZE('Teams''Teams'[Division]'Teams'[Branch]),SUMMARIZE('Project_Codes''Project_Codes'[Division]'Project_Codes'[Branch]))
            )
Step 2: I need help here. I can only get one column [Division] to work in the slicer. How to write DAX to allow the user to select the field [Division] and/or [Branch] from the page slicer??

Measure =

IF (
    OR (
        SELECTEDVALUE ( 'Slicer'[Division] ) = SELECTEDVALUE ( 'Teams'[Division] ),
        SELECTEDVALUE ( 'Slicer'[Division] ) = SELECTEDVALUE ( 'Project_Codes'[Division] )
    ),
    1,
    0
)

 

Many thanks!

1 ACCEPTED SOLUTION
Deevo_
Resolver I
Resolver I

Hi All, I managed to solve this myself by tinkering with different methods. But it all came down to just creating 2 separate measures; one for [Division] and one for [Branch]. Then I applied both measurs to the visual as a filter and set both the values = 1.

 

Division Measure =

IF (
    OR (
        SELECTEDVALUE ( 'Slicer'[Division] ) = SELECTEDVALUE ( 'Teams'[Division] ),
        SELECTEDVALUE ( 'Slicer'[Division] ) = SELECTEDVALUE ( 'Project_Codes'[Division] )
    ),
    1,
    0
)
 

Branch Measure =

IF (
    OR (
        SELECTEDVALUE ( 'Slicer'[Branch] ) = SELECTEDVALUE ( 'Teams'[Branch] ),
        SELECTEDVALUE ( 'Slicer'[Branch] ) = SELECTEDVALUE ( 'Project_Codes'[Branch] )
    ),
    1,
    0
)
 
Thanks for stopping by.

View solution in original post

3 REPLIES 3
Deevo_
Resolver I
Resolver I

Hi All, I managed to solve this myself by tinkering with different methods. But it all came down to just creating 2 separate measures; one for [Division] and one for [Branch]. Then I applied both measurs to the visual as a filter and set both the values = 1.

 

Division Measure =

IF (
    OR (
        SELECTEDVALUE ( 'Slicer'[Division] ) = SELECTEDVALUE ( 'Teams'[Division] ),
        SELECTEDVALUE ( 'Slicer'[Division] ) = SELECTEDVALUE ( 'Project_Codes'[Division] )
    ),
    1,
    0
)
 

Branch Measure =

IF (
    OR (
        SELECTEDVALUE ( 'Slicer'[Branch] ) = SELECTEDVALUE ( 'Teams'[Branch] ),
        SELECTEDVALUE ( 'Slicer'[Branch] ) = SELECTEDVALUE ( 'Project_Codes'[Branch] )
    ),
    1,
    0
)
 
Thanks for stopping by.
Deevo_
Resolver I
Resolver I

Hi lbendlin, I should have explained this differently. The [Division] and [Branch] fields from each of the two tables have two separate meanings. First being, the Leader of the Project (Lead Division and Lead Branch) and the Second being, the Division and Branches who do the work on the projects (multiple Division and Branches can work on a project).

I have 2 visuals and each use [Division] and [Branch] from two different tables, but i only want 1 slicer to affect both visuals.

1) the total number of projects (Lead Division and Lead Branch)

2) the total number of hours worked on a project (Contributing Division and Contributing Branch).

 

I hope this makes sense.

lbendlin
Super User
Super User

No need for DAX.  Add the two columns to the slicer in the right order. The hierarchy will automatically be created for you.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors