Forum Discussion

a11smiles's avatar
a11smiles
New Member
4 years ago
Solved

Joining and Filtering

Let's say I have three tables:   Food Table (Coming from OData service):   ID Food 1 Apple 2 Orange 3 Lettuce 4 Carrot 5 Grape   I also have two reference tables:   ...
  • v-chenwuz-msft's avatar
    4 years ago

    Hi a11smiles ,

     

    1 Create a table for slicer contains fruit,vegetable,orange, red and green.

    2 Create a matrix table then ID, Food in the rows and options in the columns.

    3 Create a measure like this:

    Measure =
    VAR _1 =
        SELECTEDVALUE ( 'Food Table'[ID] )
    RETURN
        SWITCH (
            SELECTEDVALUE ( Slicer[options] ),
            "fruit", IF ( _1 IN VALUES ( Fruits[ID] ), 1 ),
            "vegetable", IF ( _1 IN VALUES ( Vegetables[ID] ), 1 ),
            "red", IF ( _1 IN VALUES ( Red[ID] ), 1 ),
            "orange", IF ( _1 IN VALUES ( Orange[ID] ), 1 ),
            "green", IF ( _1 IN VALUES ( Green[ID] ), 1 )
        )
    

     

    Result:

    Pbix in the end you can refer.

    Best Regards

    Community Support Team _ chenwu zhu

     

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