Forum Discussion

amaniramahi's avatar
amaniramahi
Helper V
7 years ago
Solved

Calculated measure in column chart

Hi,

 

I have a table contains Cost and sales for many models, I managed to create a measure to calculate the profit margin (difference between them divided by the sales).

now i want to create a visulaization (column chart) to show the value of profit margin by Model, but I do so I cannot add the measure to value field.

 

When I try to add a chart visualization with the model and profit margin for each one, the figures appear properly.

 

where is my mistake?

  • Hi amaniramahi 

     

    In the modeling tab from Power BI Desktop you will find the formatting option in the 'Formatting' section for percentages.

     

    If your measure is persisted in a ssas model, click on the measure field. The properties pane should show on the bottom right. Here you can pick the option percentage and enter the correct amount of decimals under the option 'Decimal Places'.

     

    If this post helps, then please consider Accept it as the solution.

4 Replies

  • v-eachen-msft's avatar
    v-eachen-msft
    Community Support

    Hi amaniramahi ,

     

    You need to create a measure “profit margin”.

    profit margin =
    CALCULATE (
        ( SUM ( 'Table'[sales] ) - SUM ( 'Table'[cost] ) )
            / SUM ( 'Table'[sales] )
    )
    

    It is important to note that you want to change the data type of the measure to a decimal and keep two decimal places. If it is represented as whole number, it may be all 0.

    Then you can create a column visual based on these fields.

    I did not find any problems while testing, you can check the version of PowerBI and update to the latest version.

     

     

     

     

     

     

     

     

     

     

     

    Best Regards,

    Eads

     

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

    • amaniramahi's avatar
      amaniramahi
      Helper V

      Thank you v-eachen-msft , but the  problem is that I want to display the results  in % format. once I use FORMAT expression the results cannot  be visualized ..

      Is there anyway to display them as % rather than fractions?

      • MauriceMecowe's avatar
        MauriceMecowe
        Resolver II

        Hi amaniramahi 

         

        In the modeling tab from Power BI Desktop you will find the formatting option in the 'Formatting' section for percentages.

         

        If your measure is persisted in a ssas model, click on the measure field. The properties pane should show on the bottom right. Here you can pick the option percentage and enter the correct amount of decimals under the option 'Decimal Places'.

         

        If this post helps, then please consider Accept it as the solution.