Forum Discussion

InsightSeeker's avatar
InsightSeeker
Icon for Helper III rankHelper III
2 years ago
Solved

Measure %

How can i create a measure to get the result as shown in the below table? I don't want to use show value as % of grand total.

 

Table

Mode
Online
Offline
Online
Online
Online
Offline
Offline
Offline
Offline
Offline

 

Result

ModeCount
Online4
Offline6
  
ModePercentage
Online40%
Offline60%
  • Hello InsightSeeker ,

    You have to create a measure for the same as below:

    Percentage Contribution = 
    Var A = COUNTA('Table'[Mode])
    Var B = CALCULATE(COUNTA('Table'[Mode]),ALL('Table'))
    Return
    DIVIDE(A,B,0)

    Output looks like this:

    If this post helps, then please consider accepting it as the solution to help other members find it more quickly. Thank You!!

     

     

  • Hi InsightSeeker 

     

    To get the % of Offline/Online use this

     

    % = DIVIDE(CALCULATE(COUNTROWS('DataTable'), 'DataTable'[Mode] = SELECTEDVALUE('DataTable'[Mode])), CALCULATE(COUNTROWS(ALL('DataTable'))))

     

     

    Regards

     

    Phil

4 Replies

  • Hi, you can create a measure to count rows for each mode.

    Cnt = COUNTROWS(tablename)
    Below is the output:

    In the table, the mode column & the cnt measure used.

     

    If this resolves your problem, then please mark it as solution, Thanks!

  • Hello InsightSeeker ,

    You have to create a measure for the same as below:

    Percentage Contribution = 
    Var A = COUNTA('Table'[Mode])
    Var B = CALCULATE(COUNTA('Table'[Mode]),ALL('Table'))
    Return
    DIVIDE(A,B,0)

    Output looks like this:

    If this post helps, then please consider accepting it as the solution to help other members find it more quickly. Thank You!!

     

     

  • Hi InsightSeeker 

     

    To get the % of Offline/Online use this

     

    % = DIVIDE(CALCULATE(COUNTROWS('DataTable'), 'DataTable'[Mode] = SELECTEDVALUE('DataTable'[Mode])), CALCULATE(COUNTROWS(ALL('DataTable'))))

     

     

    Regards

     

    Phil