Forum Discussion
Dynamic List Selection in Power BI
- 9 years ago
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
- Set up tables like this:
SalesStores
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 ) Create relationships as follows (bidirectional between Stores & Store Filter Type):
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
- Set up tables like this:
Vvelarde that's actually a very great solution. I was noodling on a vew ways to do it with joins but didn't want to post anything overly complicated. However you presented a very good solution. Double kudos if I could.
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
- Set up tables like this:
SalesStores
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 ) Create relationships as follows (bidirectional between Stores & Store Filter Type):
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