Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi
I have this table. I need to count the number of zeros and 1's A, B and D have. I am trying countx(filter) but can't decide where am I going wrong.
| ID | values |
| a | 1 |
| a | 0 |
| d | 1 |
| b | 1 |
| a | 0 |
| d | 0 |
| b | 1 |
| b | 0 |
Solved! Go to Solution.
Hi @toobafarooqui08 ,
Multi-select (Ctrl+click) both columns. Go to the Home tab > Group By. Select Count Rows as your aggregator.
Example code:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUTJUitWBsAzArBS4WBIOWQM02SSIWCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, values = _t]),
chgTypes = Table.TransformColumnTypes(Source,{{"ID", type text}, {"values", Int64.Type}}),
groupBothColumns = Table.Group(chgTypes, {"ID", "values"}, {{"Count", each Table.RowCount(_), Int64.Type}})
in
groupBothColumns
Example output:
Pete
Proud to be a Datanaut!
Hi @toobafarooqui08 ,
Multi-select (Ctrl+click) both columns. Go to the Home tab > Group By. Select Count Rows as your aggregator.
Example code:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUTJUitWBsAzArBS4WBIOWQM02SSIWCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, values = _t]),
chgTypes = Table.TransformColumnTypes(Source,{{"ID", type text}, {"values", Int64.Type}}),
groupBothColumns = Table.Group(chgTypes, {"ID", "values"}, {{"Count", each Table.RowCount(_), Int64.Type}})
in
groupBothColumns
Example output:
Pete
Proud to be a Datanaut!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 7 | |
| 5 | |
| 5 | |
| 5 | |
| 4 |