Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Modify Values

I have a table with following numeric values:

 

 A B C
WN112.00  256.00 198.00
TD3.96 5.634615 4.506757
OD4.00 5.530435 4.320175

 

How to get the following results?

 A B C
WN112 256 198
TD3.96 5.63 4.51
OD4.0 5.5 4.3

 

The values need to be row WN =Whole Number, TD = Two Decimals, OD = One Decimal Value.

  • Hi,

    Please check the below picture and the attached pbix file.

    I suggest unpivotting the table like below, and write the measure like below.

     

     

    Result: =
    SWITCH (
    SELECTEDVALUE ( Data[Category] ),
    "WN", FORMAT ( SUM ( Data[Value] ), "#,##0" ),
    "TD", FORMAT ( SUM ( Data[Value] ), "#,##0.00" ),
    "OD", FORMAT ( SUM ( Data[Value] ), "#,##0.0" )
    )

3 Replies

  • Anonymous , You have to create a new column or measure for each one

    example

     

    A= Switch(True() ,

    [Column 1] = "WN", round([A],0) ,

    [Column 1] = "TD", round([A],2) ,

    [Column 1] = "OD", round([A],1)

    )

     

  • Hi,

    Please check the below picture and the attached pbix file.

    I suggest unpivotting the table like below, and write the measure like below.

     

     

    Result: =
    SWITCH (
    SELECTEDVALUE ( Data[Category] ),
    "WN", FORMAT ( SUM ( Data[Value] ), "#,##0" ),
    "TD", FORMAT ( SUM ( Data[Value] ), "#,##0.00" ),
    "OD", FORMAT ( SUM ( Data[Value] ), "#,##0.0" )
    )

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you Jihwan_Kim!