Forum Discussion

NidhiBhusari's avatar
NidhiBhusari
Helper IV
5 years ago
Solved

Calculating category wise % using Total

Hello,

Can anyone guide on how to calculate category wise % contribution using total.

Ex - I have age group, no of voters and on selection from slicer of particular age group % of voters in selected age category should get displayed.

Age GroupNo of Voters
21-30100000
31-40345000
41-50545000
51-657500000
66-80200000
  • NidhiBhusari , based on what I got so far , a measure like

    divide(sum(Table[No of Voters]), calculate(sum(Table[No of Voters]), allselected(Table)))

  • Hi, NidhiBhusari 

     

    Try to create a measure like this:

    Measure = 
    var _total=CALCULATE(SUM('Table'[No of Voters]),ALL('Table'))
    var _r=CALCULATE(SUM('Table'[No of Voters]))
    return DIVIDE(_r,_total)

    Result:

    Please refer to the attachment below for details

     

     

    Hope this helps.

     

    Best Regards,
    Community Support Team _ Zeon Zheng
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • NidhiBhusari , based on what I got so far , a measure like

    divide(sum(Table[No of Voters]), calculate(sum(Table[No of Voters]), allselected(Table)))

  • Hi, NidhiBhusari 

     

    Try to create a measure like this:

    Measure = 
    var _total=CALCULATE(SUM('Table'[No of Voters]),ALL('Table'))
    var _r=CALCULATE(SUM('Table'[No of Voters]))
    return DIVIDE(_r,_total)

    Result:

    Please refer to the attachment below for details

     

     

    Hope this helps.

     

    Best Regards,
    Community Support Team _ Zeon Zheng
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.