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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
maflingo
Regular Visitor

Subtracting two decimal numbers gives 100x the value

Hi,

I have an issue where I'm creating a new column in M by subtracting two columns containgin decimal values. However, when the numbers have decimals other than ,00 it returns 100x the value, so for instance 652,96-676 becomes -2304 instead of -23,04. I've tried converting the columns to decimals a few different ways, but the error persists. This is the relevant snippet in M, would be grateful if anyone has an idea, thanks!

 

   #"Changed to num" = Table.TransformColumnTypes(
    #"Expanded FactValue (2)", 
    {{"cdmValue", type number}, {"FactValue (2).cdmValue", type number}} ),
    
    // Takes the difference between this and previous month's values if 01, 02, 08 or 12, else the value
    #"Added Value-col" = Table.AddColumn(#"Changed to num", "ValueMonthly",
            each if Text.Contains([idMetric], "IF01") 
             or Text.Contains([idMetric], "IF02") 
             or Text.Contains([idMetric], "IF10") 
             or Text.Contains([idMetric], "IF12") 
            then 
                if [#"FactValue (2).cdmValue"] <> null 
                then [cdmValue] - [#"FactValue (2).cdmValue"]
                else [cdmValue]
            else [cdmValue]
            ),

    #"ValueMonthly to num" = Table.TransformColumnTypes(#"Added Value-col",{{"ValueMonthly", type number}})

 

 

1 ACCEPTED SOLUTION

Thank you both for the suggested solutions. The issue was fixed somehow while I was fixing something else. No idea what it was in the end..

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

I would specify Currency.Type instead of type number.

 

--Nate

dufoq3
Super User
Super User

Hi @maflingo, in my opinion the issue is with locale. Try to use ChangedType step with locale

 

dufoq3_0-1723720209009.png

let
    Source = Table.FromList({{652.76, 676}}, (x)=> x),
    ChangedTypeGB = Table.TransformColumnTypes(Source,{{"Column1", type number}}, "en-GB"),
    #"Added Custom" = Table.AddColumn(ChangedTypeGB, "Custom", each [Column1] - [Column2])
in
    #"Added Custom"

Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Thank you both for the suggested solutions. The issue was fixed somehow while I was fixing something else. No idea what it was in the end..

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors