Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello experts,
Is it possible for M to test whether my number values are integers?
Column1 |
0.2212 |
0.45554321 |
0.6 |
0.84321896 |
1 |
1.2 |
1.000004 |
1.76219026 |
1.8212154 |
2 |
Raw Data
Column1 | Is Integer? |
0.2212 | F |
0.45554321 | F |
0.6 | F |
0.84321896 | F |
1 | T |
1.2 | F |
1.000004 | F |
1.76219026 | F |
1.8212154 | F |
2 | T |
Desired Output
Thank you in advance.
Solved! Go to Solution.
How about this as a custom column
=if [Column1]=Int64.From([Column1]) then "T" else "F"
Hi,
In the Query Editor, use this M code
=if Number.Mod([Column1],1)=0 then "T" else "F"
Hope this helps.
Hi,
In the Query Editor, use this M code
=if Number.Mod([Column1],1)=0 then "T" else "F"
Hope this helps.
I am not sure if M has a syntax that can check for "is integer". If someone knows about it and please points me to the right direction that would be great.
In the meantime, I thought of something like this.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("LYzBDcAwCAN3ybtC2IWUzBJl/zUaBP7Yhy32HiokOM6T0dzdXqJxtkfeYhVWCWG7pqzhm8RS9lLivoZXeffnBw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type number}}), #"Duplicated Column" = Table.DuplicateColumn(#"Changed Type", "Column1", "Column1 - Copy"), #"Changed Type1" = Table.TransformColumnTypes(#"Duplicated Column",{{"Column1 - Copy", type text}}), #"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type1", "Column1 - Copy", Splitter.SplitTextByDelimiter(".", QuoteStyle.Csv), {"Column1 - Copy.1", "Column1 - Copy.2"}), #"Changed Type2" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Column1 - Copy.1", Int64.Type}, {"Column1 - Copy.2", Int64.Type}}), #"Added Custom" = Table.AddColumn(#"Changed Type2", "Custom", each if [#"Column1 - Copy.2"]=null then "T" else "F"), #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Column1 - Copy.1", "Column1 - Copy.2"}) in #"Removed Columns"
How about this as a custom column
=if [Column1]=Int64.From([Column1]) then "T" else "F"
@Zubair_Muhammad great thanks. I can loose two steps with your solution. Do you know if there is any built-in M syntax that tests for an integer?
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
71 | |
70 | |
43 | |
31 | |
26 |
User | Count |
---|---|
89 | |
49 | |
44 | |
38 | |
37 |