Forum Discussion

BIswajit_Das's avatar
BIswajit_Das
Impactful Individual
2 years ago
Solved

DAX Ideas

Hello Experts,

There's a column with value "apple","ball".

But i want to return the calculated column with values like : "apple    ", "ball   "

Thanks & Regards....

  • Anonymous's avatar
    Anonymous
    2 years ago

    BIswajit_Das  If I understand correctly, just use CONCATENATE and put as many spaces you need in the second text argument:

     

     

     

  • Finally found a way :

    In order to append extra spaces according to our requirement

    we can use the following DAX mentioned below

    i.e

    RESPONSE_C =
    VAR currentValue = 'table'[column]
    VAR currentLength =
        LEN ( CONVERT ( currentValue, STRING ) )
    VAR extraSpaces = 10 - currentLength // change 10 according to our requirement.
    VAR prefix =
        REPT ( UNICHAR ( 0160 ), extraSpaces )
    RETURN
        "" & prefix & ""
            & currentValue

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    BIswajit_Das  If I understand correctly, just use CONCATENATE and put as many spaces you need in the second text argument:

     

     

     

    • BIswajit_Das's avatar
      BIswajit_Das
      Impactful Individual

      I've got it it's in the matrix column header setting

      We've have to disable Text wrap and enable Auto-size width

      in-order to acheive my requirement.

      Thanks you...

    • BIswajit_Das's avatar
      BIswajit_Das
      Impactful Individual

      Anonymous  Thanks for responding but it's not working

      If you check it using a matrix you'll see that the spaces are ignored.

  • BIswajit_Das's avatar
    BIswajit_Das
    Impactful Individual

    Finally found a way :

    In order to append extra spaces according to our requirement

    we can use the following DAX mentioned below

    i.e

    RESPONSE_C =
    VAR currentValue = 'table'[column]
    VAR currentLength =
        LEN ( CONVERT ( currentValue, STRING ) )
    VAR extraSpaces = 10 - currentLength // change 10 according to our requirement.
    VAR prefix =
        REPT ( UNICHAR ( 0160 ), extraSpaces )
    RETURN
        "" & prefix & ""
            & currentValue