Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Create multiple slicers from two separate tables

I have a two tables that are similar (most of the columns ina table A are in table B)  , i have built dashboard where individual charts get columns  a particular table. Now i want to create multiple...
  • v-alq-msft's avatar
    6 years ago

    Hi, Anonymous 

     

    Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

     

    TableA:

     

    TableB:

     

    You may create three calculated tables and two measures as below.

    Calculated table:
    Slicer Name = DISTINCT(UNION(DISTINCT(TableA[Name]),DISTINCT(TableB[Name])))
    Slicer Class = DISTINCT(UNION(DISTINCT(TableA[Class]),DISTINCT(TableB[Class])))
    Slicer Grade = DISTINCT(UNION(DISTINCT(TableA[Grade]),DISTINCT(TableB[Grade])))
    
    Measure:
    Visual ControlA = 
    var _name = SELECTEDVALUE(TableA[Name])
    var _class = SELECTEDVALUE(TableA[Class])
    var _grade = SELECTEDVALUE(TableA[Grade])
    return
    IF(
        _name in DISTINCT('Slicer Name'[Name])&&
        _class in DISTINCT('Slicer Class'[Class])&&
        _grade in DISTINCT('Slicer Grade'[Grade]),
        1,0
    )
    
    Visual ControlB = 
    var _name = SELECTEDVALUE(TableB[Name])
    var _class = SELECTEDVALUE(TableB[Class])
    var _grade = SELECTEDVALUE(TableB[Grade])
    return
    IF(
        _name in DISTINCT('Slicer Name'[Name])&&
        _class in DISTINCT('Slicer Class'[Class])&&
        _grade in DISTINCT('Slicer Grade'[Grade]),
        1,0
    )

     

    Finally you need to put the 'Visual ControlA', 'Visual ControlB' in the corresponding visual level filter and use the 'Name', 'Class', 'Grade' column from 'Slicer Name', 'Slicer Class', 'Grade' table to filter the result.

     

     

     

    Best Regards

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.