Forum Discussion

Martin-Prague's avatar
Martin-Prague
Helper II
8 years ago
Solved

Create dynamic DAX table filtered by slicer from another table

Hello Comunity,   I would like to know, If I can create DYNAMIC DAX TABLE which is taking filter from selection by slicer in the report, and use this selection to dynamically filter this table. The...
  • Brian_M's avatar
    8 years ago

    Hi Martin, welcome to the community!

     

    A couple of key principles:

     

    1. Calculated Tables ('DAX Tables') that you can see in the Relationships screen of Power BI Desktop are calculated whenever the model is first processed (e.g. if you apply model changes from Power Query, or when you first open the model), so they can never be affected by the selection of a slicer by a user. 

     

    2.  In the model you show in your screenshot, any filter from the slicer on the Marketing Type applies from the one side (Marketing Type) down to the many side (both Campaing Master Data and KPI List), but the filter cannot flow upstream from either the KPI List or Campaing Master Data (many side) back up to the Media Type table (one the one side). 

     

    I would:

      a) create a compound key in Power Query for both Campaing Master Data & KPI List ( e.g. CompoundKey = [MarketObjective]&"-"&[MediaType] ),

      b) then I would create a DAX table Bridge = SUMMARIZE ( 'KPI List', 'KPI List'[CompoundKey] ) (you could also do this in Power Query)

      c) I would create relationships as shown below, note in particular the bi-directional relationship between Bridge and KPI List

     

    The tables and relationships are shown here: 

     

     

     

    Now when you place a slicer on Market Objective in KPI List, you will see it filters the other column Media Type in the same table giving you the filtering behaviour you desire. The relationship can flow from the many side (KPI List) to the one side (Bridge) due to the bi-directional relationship, and from the Bridge down to the Campaing Master Data table via the normal one-to-many relationship.

     

    This model may not achieve exactly what you need but hopefully it gives you some ideas.

     

     pbix file