Forum Discussion

Power_Guy's avatar
Power_Guy
Frequent Visitor
2 years ago
Solved

Percentage Calculation Dax


Hi Team,

I Need a Dynamic dax, we have two dimensional level of data(Dimension field) one is account that is first and credit that is second level
That should return % of platform measure in two different ways
 
1.i want to  divide credit value with total of commingid
this is the same way for second level categories for eg.
Private equity in coming id category
24324.95/242531.38 *100  = 10.02% (Same way need to calculate for entire as dynamic )
 
2. I want to calculate percetage of line total with grand total
For eg . Commingid category total line value is 242,531.38
Divide(242531.38,337,045.61) *100 = 7.9%
 
this 337,045 is grand total is in down



I need Help on to achive this , Expecting more suggestions here


  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Power_Guy ,

     

    Please create a new measure like:

    % of Platform = 
    VAR __cur_value = SUM('Table'[AUM])
    VAR __total_commingid = CALCULATE(SUM('Table'[AUM]),ALLEXCEPT('Table','Table'[Account]))
    VAR __grand_total = CALCULATE(SUM('Table'[AUM]),ALL('Table'[Account]))
    VAR __result = IF( ISINSCOPE('Table'[Credit]), DIVIDE(__cur_value,__total_commingid), DIVIDE(__cur_value,__grand_total))
    RETURN
    __result

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Power_Guy ,

     

    Please create a new measure like:

    % of Platform = 
    VAR __cur_value = SUM('Table'[AUM])
    VAR __total_commingid = CALCULATE(SUM('Table'[AUM]),ALLEXCEPT('Table','Table'[Account]))
    VAR __grand_total = CALCULATE(SUM('Table'[AUM]),ALL('Table'[Account]))
    VAR __result = IF( ISINSCOPE('Table'[Credit]), DIVIDE(__cur_value,__total_commingid), DIVIDE(__cur_value,__grand_total))
    RETURN
    __result

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

    • Power_Guy's avatar
      Power_Guy
      Frequent Visitor

      Hi Anonymous 
      Thank you so much for the idea,

      I have applied the same logic which u sugested but still some values are not matching
      while calculting second level values it is showing wrong values

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Power_Guy ,

        In the first screenshot you gave this part of the result seems to be correct. You just need to replace this part of the code with the code that was calculated at first time.

        % of Platform = 
        VAR __cur_value = SUM('Table'[AUM])
        VAR __grand_total = CALCULATE(SUM('Table'[AUM]),ALL('Table'[Account]))
        VAR __result = IF( ISINSCOPE('Table'[Credit]),<This part of the dax code needs to be replaced>, DIVIDE(__cur_value,__grand_total))
        RETURN
        __result

         

        Best Regards,
        Gao

        Community Support Team

         

        If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
        If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

        How to get your questions answered quickly --  How to provide sample data in the Power BI Forum