Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreThe FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now
Hi,
I'm trying to add a column to a table by which looks at value in another column and adds "Yes" or "No" depending on if it's less that 0.
The line is
= Table.AddColumn(#"Grouped Rows", "Required Rework", each if [Min Vote] < 0 then "Yes" else "No")
where the content of [Min vote] is a number and the column type if also a number. Teh Min Vote column is created in a previous Table.Group aggregate using {"Min Vote", each List.Min([Vote Only]), type number}.
However I get an error
Expression.Error: We cannot apply operator < to types Number and Text.
Details:
Operator=<
Left=0
Right=10
Any idea why this is giving me an error?
Please try this:
Table.AddColumn(#"Grouped Rows", "Required Rework", each if Number.From( [Min Vote] ) < 0 then "Yes" else "No")
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Hi @Anonymous
It works on my side.
Could you show me your code in Advanced editor?
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUTJUitWBsIzArCQgS9cYzEyGC6aABE2VYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [dsd = _t, #"Vote Only" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"dsd", type text}, {"Vote Only", Int64.Type}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"dsd"}, {{"Min Vote", each List.Min([Vote Only]), type number}}),
n=Table.AddColumn(#"Grouped Rows", "Required Rework", each if [Min Vote] < 0 then "Yes" else "No")
in
n
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
One of my stock answers on the forum now is : Try using the Column quality, distribution, profile features from the View menu to look at your data.
The M language looks fine to me.
The error message thinks there is a text value somewhere in the column
Thanks, that's the strange thing, I can't find any entry which is text, and the whole column type shows as number in the column header.
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.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 6 | |
| 6 | |
| 5 |