Forum Discussion

ashishd's avatar
ashishd
Advocate II
2 years ago
Solved

Dynamic Set operations - Intersection, Union in a visual based on user date selections

Hello friends,   I have been struggling to do a very simple operation in PowerBI and seek your help for the same. I have simplified the use case here with the below data. Date1: 5/1/2024  ...
  • TomMartens's avatar
    TomMartens
    2 years ago

    Hey ashishd ,

     

    here, you will find your pbix that now contains two measures and a new table: https://tommartens-my.sharepoint.com/:u:/g/personal/tom_minceddata_com/EQd2IMfzWjRAqvPx1pUeNGYBEjo-UJVxHBVvprbE2PI2yA?e=eD56Jo

    Please be aware that my approach is using only the date table Date1 that is NOT connected to the "fact" table Sheet1.

    The additional table is simple: it provides a "simple" llist of joinjypes, that i use as a slicer. This allows a user to select a join type, currently I have the join tpyes implemented:

    • intersect
    • leftanti (items only available in the first date)
    • rightanti (items only available in the second date)

    There is a simple measure "vizAid DateSelection" that shows a text depending on the the number of selected dates.

    The not so simple measure "Measure" basically creates two tables containing different sets of items.

    Depending of the selected join type one condition of the FILTER function will be activated. This approach is necessary because DAX does not allow that a table or column object can be created in the TRUE or FALSE branch of a conditional statement like IF or SWITCH.

    This is how my adaption looks like:

    Hopefully this provides what you are looking for.

    Regards,

    Tom