Forum Discussion

Dimitris_Kats's avatar
4 years ago
Solved

Format by row and not column (data type)

Hello dear members,

I have a problem and I do not know how I could handle it.

In the same column I have different units of measurement. For example, I can have currency, kgs, percentage and I cannot format them properly (I have as a column type text and number).

When I present the data in a report, they don’t have the appropriate format.

Is there a way to format by row instead of column?

 

Thank you in advance

  • Hi, 

    you can try something like this (look only the format)

    Column = if(dimProduct[WeightUnitMeasureID]="grams", FORMAT(dimProduct[Weight],"Fixed"), FORMAT(dimProduct[Weight]/100,"Percent"))

    If this post is useful to help you to solve your issue consider giving the post a thumbs up 

     and accepting it as a solution !

     

6 Replies

  • Hi, 

    you can try something like this (look only the format)

    Column = if(dimProduct[WeightUnitMeasureID]="grams", FORMAT(dimProduct[Weight],"Fixed"), FORMAT(dimProduct[Weight]/100,"Percent"))

    If this post is useful to help you to solve your issue consider giving the post a thumbs up 

     and accepting it as a solution !

     

    • Dimitris_Kats's avatar
      Dimitris_Kats
      Helper V

      Hello serpiva64 
      Thank you very much for your reply.

      Your solution is exactly what i need but it doesn't working. I get the exact same values 😞
      Should i change the type of the new calculated column?
      What might be the problem?

  • Vijay_A_Verma's avatar
    Vijay_A_Verma
    Most Valuable Professional

    At column level, it will be only one data type. If you want to store more than one data type in a column, then make the column text type and store these data. Hence, store the data like 12.45%, $348.95, 45.6 kgs...You will have to treat these different data types when you read them for further processing. 

  • mussaenda's avatar
    mussaenda
    Community Champion

    Hi Dimitris_Kats 

     

    You can use FORMAT from DAX to how you wanted it to be.

    You can also unpivot the data if you are open to turn them into columns instead of rows.

     

    Hope this helps.

     

  • Thank you very much for your replies.

     

    Unfortunately I can't create multiple columns for this problem or save them with symbols as text.

     

    Thank you very much for your time. Your effort is greatly appreciated

  • serpiva64 the problem was the column format. I removed the symbols and i changed the format from text to number and the DAX was working perfectly.

    Thank you very very much!!