The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I have the following sample data:
Key Status
123 Ready
123 Ready
123 In Progress
123 Done
123 Cancelled
What I need is
Key Not-Done-Items Done-Cancelled-Items
123 3 2
Is there a way to group it this way and get a sum total ?
Solved! Go to Solution.
Hi @EaglesTony ,
Please refer to the steps below:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQyVtJRCkpNTKlUitXBxffMUwgoyk8vSi0uRhJ1yc9LReI6J+Ylp+bkpKaAxYyMTVAMgvDRDYKIwg2CcJEMigUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Key = _t, Status = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Key", Int64.Type}, {"Status", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Key"}, {{"Not-Done-Items", each Table.RowCount(Table.SelectRows(_, each [Status] = "Ready" or [Status] = "In Progress")), Int64.Type}, {"Done-Cancelled-Items", each Table.RowCount(Table.SelectRows(_, each [Status] = "Done" or [Status] = "Cancelled")), Int64.Type}})
in
#"Grouped Rows"
Output:
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Try it in the Matrix Table.
I was able to use a measure for this.
@EaglesTony Please try the below measures:
I think you mean [Status] = "Done" ?
Is there a way to do this in PowerQuery instead of DAX ?
Hi @EaglesTony ,
Please refer to the steps below:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQyVtJRCkpNTKlUitXBxffMUwgoyk8vSi0uRhJ1yc9LReI6J+Ylp+bkpKaAxYyMTVAMgvDRDYKIwg2CcJEMigUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Key = _t, Status = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Key", Int64.Type}, {"Status", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Key"}, {{"Not-Done-Items", each Table.RowCount(Table.SelectRows(_, each [Status] = "Ready" or [Status] = "In Progress")), Int64.Type}, {"Done-Cancelled-Items", each Table.RowCount(Table.SelectRows(_, each [Status] = "Done" or [Status] = "Cancelled")), Int64.Type}})
in
#"Grouped Rows"
Output:
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
User | Count |
---|---|
77 | |
75 | |
36 | |
31 | |
29 |
User | Count |
---|---|
94 | |
80 | |
55 | |
48 | |
48 |