Reputation: 38
I'll start by saying that I'm fairly new to Power BI and am finding my way around, but really am struggling with the concept of lists in a column. I'll explain where I have got in a made up but real world example - sorry if it is rather long winded.
So for my example I have orders in a restaurant, as per the following table:
ID Person Order Alcohol
1 Bob Pizza,fries,beer Yes
2 Fred Pizza,salad,dressing,wine Yes
3 Pete Lasagne,fries,cola No
4 Dave Pizza,fries,cola No
5 Bob Sundae No
I would like to be able to show on a report
I'd also like to be able to filter across those visualisations, i.e. clicking a row in a bar chart or a portion of the doughnut filters the other visualisations. So, I could for example see which orders included alcohol, or how many people ordered fries and alcohol.
This is where I am becoming stuck.
In order to get the count of the each of the items ordered, I have duplicated the Order column, calling it OrderItem, and then split OrderItem on the comma delimiter, creating new rows. Doing this gives 14 rows, but allows me to
So I'd like to know how I can get the count of alcohol to reflect the distinct orders rather than the total number of rows.
One approach I tried was to create a duplicate table in PowerQuery, and split that duplicate into rows for each Order Item. That works to a fashion in that I can use the original table for the alcohol doughnut and the table with a row for each item for the counts.
The downside with that approach is that if I click the "fries" row in the bar chart, it doesn't then filter the alcohol doughnut to show which orders with fries had alcohol.
Any advice on how to get the correct count in the doughut AND the filtering would be very much appreciated!
Upvotes: 1
Views: 1462
Reputation: 60
Now each order has a value to it, so you can begin to specifically start counting each specific order item. These values will be unique.
As you mentioned, the issue now is alcohol, ID, and person are duplicated. This is where measures are important. So for alcohol, you create a measure.
Measure = CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER('Table','Table'[Alcohol] = "Yes"))
To get the no values, simply do the same measure with "No"
Upvotes: 1