I’m new to Power BI.
I have a table like this:
Type | Food | Hygiene | NFI |
---|---|---|---|
City | 1 | 2 | 1 |
City | 3 | 1 | 1 |
Village | 1 | 1 | 2 |
City | 2 | 2 | 1 |
Village | 1 | 3 | 1 |
City | 3 | 3 | 2 |
I want to have a Ribbon chart with:
Ribbons (Legend): Food, Hygiene and NFI
X-axis: 1 2 3
Y-axis: Count of proper X, so for Food it is like
o
o o
o o o
1 2 3
And I want also have a Slicer for Type, so if I select City, Food ribbon changes:
o
o o o
1 2 3
I made a Calculated table
T1 =
VAR UniqueVals =
DISTINCT(UNION(
SELECTCOLUMNS(main, "Value", main[Food]),
SELECTCOLUMNS(main, "Value", main[Hygiene]),
SELECTCOLUMNS(main, "Value", main[NFI]),
))
RETURN
ADDCOLUMNS(
UniqueVals,
"Food", CALCULATE(COUNTROWS(main), main[Food] = EARLIER([Value])),
"Hygiene", CALCULATE(COUNTROWS(main), main[Hygiene] = EARLIER([Value])),
"NFI", CALCULATE(COUNTROWS(main), main[NFI] = EARLIER([Value])),
)
which gives me what I need for a chart. Than I found out that Slicer doesn’t affect calculated tables. Pity!
It looks like measures are recalculating. But how can I use it here? Or are there any other ways?
Mitya Kobrinsky is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.