Forum Discussion

Prakash1050's avatar
Prakash1050
Helper III
3 years ago

Need Dax Measure

Hi All,

       I need DAX Measure for below the Scenario.

 

I have one Column.

 

         Values

           100

           200

           300

 

         What i need is This Column total is 600. I need all the row divided by the total. Ex : 100/600 = 0.17 , 200/600 = 0.34 like that.

          I used this measure ( DAX = 

                                                  var value = calculate(sum(Values))
                                                  var allValue = calculate(sum(Values) , Allselected(Values)) 
                                             Return value/allValue  )

 

             But this measure is not working correctly.

 

 Please help me to done this logic.

Thanks in Advance.

4 Replies

  • mlsx4's avatar
    mlsx4
    Memorable Member

    Hi Prakash1050 

     

    I would use two measures:

    Total sum= SUM(Values)

    And then,

    % of value = 
    
    var allValues= CALCULATE([Total sum],ALL(Table))
    return DIVIDE([Total sum],allValues,0)
    • Prakash1050's avatar
      Prakash1050
      Helper III

      Hi mlsx4
            Thanks for your reply.

            This measure works correct. If i have id column as well.

      Ex : 

               ID         Value

                1           100

                2           200

                3           200

                1           400

                1           100

                2            200

       

      Above the table ID in filters, if i select ID 1 means only 3 ID, Values rows are coming and the above measure is not suitable for this scenario.

      So, kindly done this logic.

       

       

      • mlsx4's avatar
        mlsx4
        Memorable Member

        Hi Prakash1050 

         

        Not really understand the point. Can you put an example of what you do and what you expect to get?