Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Adding comma in PQ

Hello,

 

I created a new column in PQ that concatnates two values: Date and Sales

 

heres the code:

 

Date.ToText([Date]) & " - "& Number.ToText([Sales])

 

the problem is the sales doesnt have a thousands separator.

 

is there a way to add a thousands separator to this code?

 

thank you!!

  • Hi,

    use the following M-Code:

     

    Date.ToText([Date]) & "-" & Number.ToText([Sales],"#,##0.00"))

     

    Regards FrankAT

4 Replies

  • VasTg's avatar
    VasTg
    Memorable Member

    Anonymous 

     

    Why do want to achieve that in M query instead in the model section?

     

    If it helps, mark it as a solution

    Kudos are nice too

  • mwegener's avatar
    mwegener
    Most Valuable Professional

    Hi Anonymous ,

     

    it's easier with DAX

     

    Column = FORMAT('Table'[Date], "mm/dd/yyyy") & " - " & FORMAT('Table'[Sales],"0,000.00")

     

    Regards,

    Marcus

    Dortmund - Germany
    If I answered your question, please mark my post as solution, this will also help others.
    Please give Kudos for support.

  • FrankAT's avatar
    FrankAT
    Community Champion

    Hi,

    use the following M-Code:

     

    Date.ToText([Date]) & "-" & Number.ToText([Sales],"#,##0.00"))

     

    Regards FrankAT

    • Anonymous's avatar
      Anonymous
      Not applicable

      perfect thank you much