Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Adding commas to a text numeric value

I have text type column1 which has  some numberic values.I want to put commas to the values, just like the screenshot shown above.. I tried like below... but not done correctly...Plse help te...
  • v-xiaotang's avatar
    5 years ago

    Hi Anonymous 

    you can use this measure:

     

    Measure = 
    var _text=MIN('Table'[Column1])
    var _len=LEN(MIN('Table'[Column1]))
    return 
    SWITCH(TRUE(),
    _len<=3,_text,
    _len>3&&_len<=6,LEFT(_text,_len-3)&","&RIGHT(_text,3),
    _len>6&&_len<=9,LEFT(_text,_len-6)&","&MID(_text,_len-5,3)&","&RIGHT(_text,3))

     

    result

     

     

     

    Best Regards,

    Community Support Team _ Tang

    If this post helps, please consider Accept it as the solution to help the other members find it more quickly.