Forum Discussion

rubenfm's avatar
rubenfm
New Member
2 years ago
Solved

Measure power bi

Hello,

 

I want to create a measure that divide the sales of a category by the total sales of the same month to represent later the % of sales for each category and month in a chart, but I'm unable to find one measure that works properly.  I have attached an image with the desired output in Excel. 

 

Thank you

  • Hi,

    I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

     

     

     

     

    % measure: =
    VAR _value =
        SUM ( data[value] )
    VAR _allcategory =
        CALCULATE ( SUM ( data[value] ), ALL ( category[category] ) )
    RETURN
        DIVIDE ( _value, _allcategory )
    

     

  • rubenfm's avatar
    rubenfm
    2 years ago

    That's exactly what I needed. You've saved my life.

     

    Thank you!

2 Replies

  • Hi,

    I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

     

     

     

     

    % measure: =
    VAR _value =
        SUM ( data[value] )
    VAR _allcategory =
        CALCULATE ( SUM ( data[value] ), ALL ( category[category] ) )
    RETURN
        DIVIDE ( _value, _allcategory )
    

     

    • rubenfm's avatar
      rubenfm
      New Member

      That's exactly what I needed. You've saved my life.

       

      Thank you!