Forum Discussion

Humpjs's avatar
Humpjs
Advocate I
9 years ago
Solved

Dynamic List Selection in Power BI

I'm new to Power BI as our company is about to roll it out and I'm one of the first to have to learn it.   Been perusing this site daily and have learned so much already.     However, I've reached an...
  • OwenAuger's avatar
    OwenAuger
    9 years ago

    Humpjs

     

    Here is another method you can use, similar logic to Vvelarde but with physical relationships.

    It's based on Anonymous's post here: Tiny Lizard - Dynamically changing chart axis

     

    Example pbix here.

     

    1. Set up tables like this:
      Sales

      Stores 

      Store Filter Type

      Sample DAX:

      Store Filter Type =
      VAR FranchiseeTable =
          SELECTCOLUMNS (
              Stores,
              "Store Name", Stores[Store Name],
              "Type", "Franchisee Name",
              "Value", Stores[Franchisee Name]
          )
      VAR DistrictTable =
          SELECTCOLUMNS (
              Stores,
              "Store Name", Stores[Store Name],
              "Type", "District Name",
              "Value", Stores[District Name]
          )
      VAR StoreTable =
          SELECTCOLUMNS (
              Stores,
              "Store Name", Stores[Store Name],
              "Type", "Store Name",
              "Value", Stores[Store Name]
          )
      RETURN
          UNION ( FranchiseeTable, DistrictTable, StoreTable )

       

       

    2. Create relationships as follows (bidirectional between Stores & Store Filter Type):

       

    3.  Then you can simply filter on 'Store Filter Type'[Type], with 'Store Filter Type'[Value] on the visual's axis, with a SUM ( Sales[Sales] ) measure. You still have the ability to filter on Stores if you want, or you could eliminate Franchisee/District columns from Stores.

    Regards,

    Owen