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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
M_nwadibia
Resolver III
Resolver III

add comma separator to numbers

I have a requirement to add (,) separator to 2 digit number or 3 as I have in the screen shot below. I need an expression to achieve this. Any help will be appreciated

 

M_nwadibia_1-1670531288259.png

 

 

1 ACCEPTED SOLUTION

I used the expression below to solve the comma requirements. I got the hint from the link below

=Replace(Replace(Fields!field1.Value,"1","a"),"0","b")

=Replace(Replace(Fields!Field1.Value,"Test","Test A"),"Test A B","Test C")

https://stackoverflow.com/questions/7608128/is-it-possible-to-use-one-replace-function-to-replace-mu...

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @M_nwadibia , 

 

Please try this in Power Query editor:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlSK1YlWMgKTxmDSxBRMmZlbKMXGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", Int64.Type}}),
    #"Duplicated Column" = Table.DuplicateColumn(#"Changed Type", "Column1", "Column1 - Copy"),
    #"Split Column by Position" = Table.ExpandListColumn(Table.TransformColumns(Table.TransformColumnTypes(#"Duplicated Column", {{"Column1 - Copy", type text}}, "en-US"), {{"Column1 - Copy", Splitter.SplitTextByRepeatedLengths(1), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Column1 - Copy"),
    #"Grouped Rows" = Table.Group(#"Split Column by Position", {"Column1"}, {{"Count", 
each Text.Combine( [#"Column1 - Copy"],","), type nullable number}}),
    #"Changed Type2" = Table.TransformColumnTypes(#"Grouped Rows",{{"Count", type text}})
in
    #"Changed Type2"

 

vcaitlynmstf_0-1670553180692.png

 

You may also try measure like this :

Measure =
VAR _selvalue =
    SELECTEDVALUE ( 'Table'[Column1] )
RETURN
    IF (
        LEN ( _selvalue ) > 1,
        LEFT ( _selvalue, 1 ) & ","
            & RIGHT ( _selvalue, 1 ),
        _selvalue
    )

(If you have more than 2 multi-digits, then this measure may not always meet your needs)

 

 

 

Best regards.
Community Support Team_ Caitlyn

This is in Reporting service and not Power BI. I need an expression in reporting service to achieve this.

I used the expression below to solve the comma requirements. I got the hint from the link below

=Replace(Replace(Fields!field1.Value,"1","a"),"0","b")

=Replace(Replace(Fields!Field1.Value,"Test","Test A"),"Test A B","Test C")

https://stackoverflow.com/questions/7608128/is-it-possible-to-use-one-replace-function-to-replace-mu...

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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