Forum Discussion

lukexuereb's avatar
lukexuereb
Regular Visitor
5 years ago
Solved

Split Values in Matrix by Different Rows (Which have the same type of data)

I am displaying 2 different calculated measures in a matrix (Comp 1st Review and Comp 2nd Review). As seen below:

Comp 1st ReviewComp 2nd Review
84

 

I then split the above values by Computation1stReviewer. This field displays a list of peoples names, therefore the below matrix outputs a count of rows of each person for each measure:

 

Computation1stReviewerComp 1st ReviewComp 2nd Review
Person A10
Person B23
Person C51
Total84

 

The above was performed by adding Computation1stReviewer to 'Rows', as seen below:

 

My challenge is that I would not like the second measure (Comp 2nd Review) to be split into rows based on Computation1stReviewer, but I would like it to be split into rows by a different field, Computation2ndReviewer, which also displays a set of names. Therefore, below is the output which I am seeking:

Computation1stReviewerComp 1st ReviewComp 2nd Review
Person A1Comp 2nd Review Filtered by Computation2ndReviewer[Person A]
Person B2Comp 2nd Review Filtered by Computation2ndReviewer[Person B]
Person C5Comp 2nd Review Filtered by Computation2ndReviewer[Person C]
Total84

 

Note that there exists an overlap in names between Computation1stReviewer and Computation2ndReviewer. Although some names do exist in the former measure that do not exist in the latter, and vice versa.

 

I am unsure how to go about this, and would greatly appreciate any help or suggestions that you might have. Thank you! 

  • Hi lukexuereb ,

     

    Try the following formula:

     

    Measure = 
    var _1 =
        CALCULATE(
            DISTINCTCOUNT('Table'[Column2]),
            FILTER(
                ALL('Table'),
                'Table'[Computation2ndReviewer] = MAX('Table'[Computation1stReviewer])
            )
        )
    return 
        IF(
            ISFILTERED('Table'[Computation1stReviewer]),
            _1,
            [Comp 2nd Review]
        )

     

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

    Best Regards,
    Winniz

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

4 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    lukexuereb Sorry, having trouble following, can you post sample data as text and expected output?
    Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

    Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

    The most important parts are:
    1. Sample data as text, use the table tool in the editing bar
    2. Expected output from sample data
    3. Explanation in words of how to get from 1. to 2.

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        lukexuereb I'm still not clear on what your source data looks like. However, it sounds like you have two columns of names. Try upivoting those columns and then you can filter by the Attribute field in your measures?

  • v-kkf-msft's avatar
    v-kkf-msft
    Community Support

    Hi lukexuereb ,

     

    Try the following formula:

     

    Measure = 
    var _1 =
        CALCULATE(
            DISTINCTCOUNT('Table'[Column2]),
            FILTER(
                ALL('Table'),
                'Table'[Computation2ndReviewer] = MAX('Table'[Computation1stReviewer])
            )
        )
    return 
        IF(
            ISFILTERED('Table'[Computation1stReviewer]),
            _1,
            [Comp 2nd Review]
        )

     

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

    Best Regards,
    Winniz

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