Forum Discussion

Raj12's avatar
Raj12
Helper III
3 years ago
Solved

Count records in table ignoring groups in a table in Power Bi

Hi, I want to get pecentage per group i.e Total value of a Group/ Total Value I am trying to get total value of all groups from the data table but when I put that measure in a table it gets divided...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Raj12 ,

    Why is the total 8 and not 9?

    Please check if this is your expected output.

    pecentage per group = 
    VAR _count = COUNTROWS('Table')
    VAR _count_all = CALCULATE(COUNTROWS('Table'),ALL())
    VAR _result = DIVIDE(_count,_count_all)
    RETURN
    _result

     If you need the total to always be at 100%, try this.

    VAR _count = COUNTROWS('Table')
    VAR _count_all = CALCULATE(COUNTROWS('Table'),ALLSELECTED())
    VAR _result = DIVIDE(_count,_count_all)
    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