Forum Discussion

jananagarajan's avatar
jananagarajan
Regular Visitor
3 years ago
Solved

How to convert Calculated Column (Text) to Measure

How to convert Calculated Column (Text) to Measure in DAX

 

 I have the values in Percentage say 

 

100%

98.5%

97.2%

96%...........

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi jananagarajan ,

    The functions used in the calculated column and the functions used in the measure are common, so if you need to convert the calculated column to a measure, the only thing you need to do is make sure the context is correct.

    Please refer below sample:

    1. below is my test table

    Table:

    2. add a new column with below dax formula

    Profit Margin Calculate Column = DIVIDE([Profit],[Cost])

    3. create a measure with below dax formula

    Measure =
    VAR cur_cost =
        SELECTEDVALUE ( 'Table'[Cost] )
    VAR cur_profit =
        SELECTEDVALUE ( 'Table'[Profit] )
    RETURN
        DIVIDE ( cur_profit, cur_cost )
    

    4. add a table visual with fields and measure

    Please refer the attached .pbix file.

     

    Best regards,
    Community Support Team_ Binbin Yu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi jananagarajan ,

    The functions used in the calculated column and the functions used in the measure are common, so if you need to convert the calculated column to a measure, the only thing you need to do is make sure the context is correct.

    Please refer below sample:

    1. below is my test table

    Table:

    2. add a new column with below dax formula

    Profit Margin Calculate Column = DIVIDE([Profit],[Cost])

    3. create a measure with below dax formula

    Measure =
    VAR cur_cost =
        SELECTEDVALUE ( 'Table'[Cost] )
    VAR cur_profit =
        SELECTEDVALUE ( 'Table'[Profit] )
    RETURN
        DIVIDE ( cur_profit, cur_cost )
    

    4. add a table visual with fields and measure

    Please refer the attached .pbix file.

     

    Best regards,
    Community Support Team_ Binbin Yu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.