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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
ThisIsIt
Frequent Visitor

Insert Decimal

Good morning! I have a whole number column, and I'd like to insert a decimal after the second digit. How would I go about doing this? Example below. Currently the number is: 12345678 I'd like the number to be: 12.345678 Also something the number is 0. If 0 i just want it to stay 0 (if possible). Thank you!
1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@ThisIsIt - Perhaps:

DAX Column = IF([Column] = 0,0,[Column]/1000000)

Power Query Column = if [Column] = 0 then 0 else [Column]/1000000


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
FrankAT
Community Champion
Community Champion

Hi @ThisIsIt 

if the length of the whole number differs you can do it with Power Query like this:

 

 

// Table
let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQyNjE1M7dQio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Value = _t]),
    #"Added Custom" = Table.AddColumn(Source, "Custom", each Text.Start([Value],2) & "." & Text.End([Value],Text.Length([Value])-2)),
    #"Changed Type" = Table.TransformColumnTypes(#"Added Custom",{{"Custom", type number}})
in
    #"Changed Type"

 

 

or you can do it with DAX:

 

25-08-_2020_13-27-33.png

 

 

Decimal Number = 
CONVERT (
    LEFT ( CONVERT ( 'Table (2)'[Value], STRING ), 2 ) & "."
        & RIGHT (
            CONVERT ( 'Table (2)'[Value], STRING ),
            LEN ( CONVERT ( 'Table (2)'[Value], STRING ) ) - 2
        ),
    DOUBLE
)

 

 

A shorter version of the above DAX formula is:

Decimal Number = 
CONVERT (
    LEFT ( 'Table (2)'[Value], 2 ) & "."
        & RIGHT (
            'Table (2)'[Value],
            LEN ('Table (2)'[Value] ) - 2
        ),
    DOUBLE
)

Regards FrankAT

Thank you all for you quick replies and suggestions.  They all work for me.  Really appreicate it!

Greg_Deckler
Community Champion
Community Champion

@ThisIsIt - Perhaps:

DAX Column = IF([Column] = 0,0,[Column]/1000000)

Power Query Column = if [Column] = 0 then 0 else [Column]/1000000


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

@ThisIsIt ,

create a number like [column]/1000000 , change data type to decimal with 6 decimal place

 

12345678/1000000

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.