Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi all,
For example, I have this data from a review process:
ID | Rating |
57795 | A |
57795 | Pass |
57795 | Pass |
57795 | A |
What I want to do is have a single result returned for ID 57795 of 'A' (other alternatives are B, C, Pass and Fail) - there's quite a few records and I wondered if there was a Power Query that I could use that would look at the ID then the ratings column, and then provide the highest rating for each ID once.
Thanks!
Hi,
Im a bit unclear about Your requirement but It seems you are Looking For a single row for Id and all the ratings of the Id in the same row,
If this is your Requirement then try this out ,
This is my Sample Table,
Use group by as in below Screenshot,
There will be a error,
To solve this us below Expression
= Table.Group(#"Changed Type", {"ID"}, {{"Result", each Text.Combine([Rating],","), type nullable
Thanks!
Inogic Professional Service Division
An expert technical extension for your techno-functional business needs
Power Platform/Dynamics 365 CRM
Drop an email at crm@inogic.com
Service: http://www.inogic.com/services/
Power Platform/Dynamics 365 CRM Tips and Tricks: http://www.inogic.com/blog/
Thanks - very useful, to confirm I would just want the highest rating returned, but this is a useful start!
Hi @Anonymous ,
If you want the highest Ratings so instead of Combining, you need to Use Max of ratings in Group by as in Screenshot,
Note that we are considering that your Ratings is Numerical column.
Thanks!
Inogic Professional Service Division
An expert technical extension for your techno-functional business needs
Power Platform/Dynamics 365 CRM
Drop an email at crm@inogic.com
Service: http://www.inogic.com/services/
Power Platform/Dynamics 365 CRM Tips and Tricks: http://www.inogic.com/blog/
Hi this example should give you what you want, however, if you want a different order of ratings then add an integer column for every rating and group by that
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjU3tzRV0lFyVIrVQfACEouL8QtA1RsbGZoAeU4oPLfEzByl2FgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Rating = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Rating", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"ID"}, {{"Rating", each List.Min([Rating]), type nullable text}})
in
#"Grouped Rows"
Thanks for this - looks good, although I'll need to look at the code so I can understand it myself (it's really appreciated that you've provided this, I just need to understand it so I can apply it to similar situations in future!).
Think how you might do this in real life: You would GROUP BY the ID column and take the MIN of the Rating column, or whatever aggregation gets you A values instead of B. Create a DAX (or Power Query) table that does that aggregation.
If you sort your distint list of Ratings, the list would be, in alphabetical order, A, B, D, Fail, Pass (because the F in Fail comess before the P in Pass). If you want Pass to come before Fail, then you should probably convert the letters to numbers: A=1, B=2, C=3, Pass=4, Fail=5, and get the MIN of the number.
Proud to be a Super User! | |
Thanks for this guidance - it's helpful to have someone simply explain to my what I'm trying to do in terms that I can apply to PowerBI! I had hit a wall and had no one to speak with, but the way you've described this is really useful.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
100 | |
65 | |
48 | |
39 | |
32 |
User | Count |
---|---|
167 | |
117 | |
61 | |
58 | |
45 |