Reputation: 1
I am creating a dashboard in Power BI and want to build a visual (specifically a tree map) that shows how a selected product is performing within its subcategory. The idea is that when a user selects a product via a slicer, the visual should extract the subcategory of the chosen product and filter the tree map accordingly to show performance within that subcategory.
I attempted to write a DAX measure to achieve this behavior, but the solution doesn't seem to work. I also blocked interactions between the slicer and the tree map visual to prevent other issues, but I still don't get the desired outcome.
Any advice on how to approach this?
So I tried to write a code with a help from Chat GPT. We created 2 measures:
SelectedSubCategories =
VAR SelectedProduct = SELECTEDVALUE(FactSales[Product])
RETURN
IF (
ISBLANK(SelectedProduct),
BLANK(), -- Jeśli nie wybrano żadnego produktu, zwróć BLANK
CONCATENATEX(
VALUES(FactSales[Sub_Category]),
FactSales[Sub_Category],
", "
)
)
This one is supposed to extract the subcategories of the selected product
ShowProductsInSameSubCategory =
IF(
[SelectedSubCategories] = MAX(FactSales[Sub_Category]),
1,
0
)
And this one is supposed to be used as a filter on the treemap to show only subcategories that are the same as the selected product. From what I have explored, first code is extracting the subcategories correctly but the second one is not filtering correctly. How to solve this issue?
Upvotes: 0
Views: 101