Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Given this type of data:
Suppose I want to make two different graphs, one for the individual count of the items in the Order column and one for the Pets column. What would be the simplest way to do this?
Note that I want to graph the count of each item, and not group of items. This way I'd obtain a count of 4 - Burger, 2 - Pizza, and not 1- Burger, 1 - Pizza, Coke and so on.
Solved! Go to Solution.
Hi, @Anonymous ;
You could change “,” to “|” in power query . Then create a new table in Power BI , Finally count of “Order” and “Pets” , the following formula to create :
Step1: Duplicate Order 、Pets columns
Step2: Replace Order 、Pets columns(“,” ->”|”)
Step3:Create new table
NewTable =
var _a=SELECTCOLUMNS('Table',"order",PATHITEM([Order2],1,TEXT),"pets",PATHITEM([Pets2],1,TEXT))
var _b=SELECTCOLUMNS('Table',"order",PATHITEM([Order2],2,TEXT),"pets",PATHITEM([Pets2],2,TEXT))
var _c=SELECTCOLUMNS('Table',"order",PATHITEM([Order2],3,TEXT),"pets",PATHITEM([Pets2],3,TEXT))
return UNION(_a,_b,_c)
Step4:Create two measures to calculate count
ordercount = COUNT('NewTable'[order])
percount = COUNT('NewTable'[pets])
The final output is shown below:
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Anonymous ;
You could change “,” to “|” in power query . Then create a new table in Power BI , Finally count of “Order” and “Pets” , the following formula to create :
Step1: Duplicate Order 、Pets columns
Step2: Replace Order 、Pets columns(“,” ->”|”)
Step3:Create new table
NewTable =
var _a=SELECTCOLUMNS('Table',"order",PATHITEM([Order2],1,TEXT),"pets",PATHITEM([Pets2],1,TEXT))
var _b=SELECTCOLUMNS('Table',"order",PATHITEM([Order2],2,TEXT),"pets",PATHITEM([Pets2],2,TEXT))
var _c=SELECTCOLUMNS('Table',"order",PATHITEM([Order2],3,TEXT),"pets",PATHITEM([Pets2],3,TEXT))
return UNION(_a,_b,_c)
Step4:Create two measures to calculate count
ordercount = COUNT('NewTable'[order])
percount = COUNT('NewTable'[pets])
The final output is shown below:
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Here's the table so I can come back to this:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("fY/LCsMgEEV/RWbtT6SWPhYtWXUTXAzpECRGwSSkzdd3lMYKga686vF6pmngTD50BBIOM6+Bw9F3oGUDlXPI29qsK0qhfB8phVO6vGF450dSnIKhMUPcwPlLVpZev5oE7hD3DLTw6bUloQLhwPmCwzixUARqnG3xW4mlopK9m7aPotlXih0T++Jsm80m8kBL/+cCrT8=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, Order = _t, Pets = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Order", type text}, {"Pets", type text}})
in
#"Changed Type"
Proud to be a Super User!
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
90 | |
87 | |
84 | |
68 | |
49 |
User | Count |
---|---|
131 | |
111 | |
96 | |
71 | |
67 |