Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Comparing Group By Aggregation

Hello,

 

I am creating an aggregated table in Power Query using Group By functionality and once I do that I have a column that has an Average Score. When I compare this Avergage Score (it has decimal numbers) to another column that is also of decimal number type, I get an error message.

Expression.Error: We cannot apply operator < to types List and Number.
Details:
Operator=<
Left=[List]
Right=8.13

Does anyone know what mistake am i making or how to fix this?

Thank you

1 ACCEPTED SOLUTION

Hello @Anonymous 

 

exactly, with Def[Target] you are referencing a list. Now depends what kind of calculation you want to apply. Like List.Sum, List.Max etc. you can also referencing the first item by adding {0} after your list reference

 

Copy paste this code to the advanced editor in a new blank query to see how the solution works. If this solution fits your need, copy and past a part of it and implement it in your query, or I could create a custom function what makes it easier to apply if you are not used that much to power query.

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

I realized that my Def[Target] is not a single number but a list of numbers. As soon as I figured out how to resolve that into a single number, the error disappeared.

Hello @Anonymous 

 

exactly, with Def[Target] you are referencing a list. Now depends what kind of calculation you want to apply. Like List.Sum, List.Max etc. you can also referencing the first item by adding {0} after your list reference

 

Copy paste this code to the advanced editor in a new blank query to see how the solution works. If this solution fits your need, copy and past a part of it and implement it in your query, or I could create a custom function what makes it easier to apply if you are not used that much to power query.

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

AlB
Super User
Super User

Hi @Anonymous 

The error message is quite clear. You are comparing a list and a number. Show the M code so that we can see where the mistake is.

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

 

Anonymous
Not applicable

= Table.AddColumn(#"Changed Type", "Indicator", each if [Score] < Def[Target] then "Met" else "Not Met")

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors