Forum Discussion

WJ876400's avatar
WJ876400
Helper IV
7 years ago
Solved

Averages

Hi

 

I have a list of teachers and students and there students current status like below. What I want to do is calculate percentages based on their status so I can see a withdrawn status.

 

The list is similar to thisThis is the outcome I am looking for

 

Any help is appreciated, thanks

  • Hi WJ876400 

    Assuming students appear only once per teacher, try this:

    1. Place Table1[Teacher] in the rows on  a matrix visual

    2. Place Table1[Status] in the columns of the matrix visual

    3. Create this measure, format as %, and place it in values of the matrix

    Measure =
    DIVIDE (
        COUNT ( Table1[Student] ),
        CALCULATE ( COUNT ( Table1[Student] ), ALL ( Table1[Status] ) )
    )
    

    Please always show your sample data in text-tabular format in addition to (or instead of) the screen captures. A screen cap doesn't allow people to readily copy the data and run a quick test and thus decreases the likelihood of your question being answered. Just use 'Copy table' in Power BI and paste it here. Or, ideally, share the pbix (beware of confidential data).

3 Replies

  • AlB's avatar
    AlB
    Community Champion

    Hi WJ876400 

    Assuming students appear only once per teacher, try this:

    1. Place Table1[Teacher] in the rows on  a matrix visual

    2. Place Table1[Status] in the columns of the matrix visual

    3. Create this measure, format as %, and place it in values of the matrix

    Measure =
    DIVIDE (
        COUNT ( Table1[Student] ),
        CALCULATE ( COUNT ( Table1[Student] ), ALL ( Table1[Status] ) )
    )
    

    Please always show your sample data in text-tabular format in addition to (or instead of) the screen captures. A screen cap doesn't allow people to readily copy the data and run a quick test and thus decreases the likelihood of your question being answered. Just use 'Copy table' in Power BI and paste it here. Or, ideally, share the pbix (beware of confidential data).

    • WJ876400's avatar
      WJ876400
      Helper IV

      Thanks AlB  that worked. Thank you for the tip on sharing data so it can be tested