Forum Discussion

JoyfulJess's avatar
JoyfulJess
Frequent Visitor
4 years ago
Solved

How to create a Card visual by adding up the selected subtotals of a matrix visual?

Hi all

 

Can anyone help me out here?

 

I am trying to compile the survey results and there are 6 ratings. I created a matrix visual showing the count per question, per rating. How do I create a card visual reflecting only the sum of subtotal of rating 5 and 6? ie, I need a card visual which shows  81.64% by the side.

 

 

  • Hi JoyfulJess ,

    Base on your table ,create the following measure:

    test1 = 
    IF (
        HASONEVALUE ( 'Table'[Question] ),
        MAX ( 'Table'[value] ),
        CALCULATE (
            SUM ( 'Table'[value] ),
            FILTER (
                ALL ( 'Table' ),
                (
                    'Table'[TYPE] = MAX ( 'Table'[TYPE] )
                        && 'Table'[Question] = 5
                )
                    || (
                        'Table'[TYPE] = MAX ( 'Table'[TYPE] )
                            && 'Table'[Question] = 6
                    )
            )
        )
    )
    
    test1 = 
    IF (
        HASONEVALUE ( 'Table'[Question] ),
        MAX ( 'Table'[value] ),
        CALCULATE (
            SUM ( 'Table'[value] ),
            FILTER (
                ALL ( 'Table' ),
                (
                    'Table'[TYPE] = MAX ( 'Table'[TYPE] )
                        && 'Table'[Question] = 5
                )
                    || (
                        'Table'[TYPE] = MAX ( 'Table'[TYPE] )
                            && 'Table'[Question] = 6
                    )
            )
        )
    )
    

     

    Output refer:

     

    You can adapt my Dax. to your specific environment.

     

    Did I answer your question? Mark my post as a solution!


    Best Regards

    Lucien

2 Replies

  • Hi JoyfulJess ,

     

    I'm not sure but probably we need to use SUMMARIZE() and SUMX(). Can you send me a sample file, please?

     

     

  • v-luwang-msft's avatar
    v-luwang-msft
    Icon for Community Support rankCommunity Support

    Hi JoyfulJess ,

    Base on your table ,create the following measure:

    test1 = 
    IF (
        HASONEVALUE ( 'Table'[Question] ),
        MAX ( 'Table'[value] ),
        CALCULATE (
            SUM ( 'Table'[value] ),
            FILTER (
                ALL ( 'Table' ),
                (
                    'Table'[TYPE] = MAX ( 'Table'[TYPE] )
                        && 'Table'[Question] = 5
                )
                    || (
                        'Table'[TYPE] = MAX ( 'Table'[TYPE] )
                            && 'Table'[Question] = 6
                    )
            )
        )
    )
    
    test1 = 
    IF (
        HASONEVALUE ( 'Table'[Question] ),
        MAX ( 'Table'[value] ),
        CALCULATE (
            SUM ( 'Table'[value] ),
            FILTER (
                ALL ( 'Table' ),
                (
                    'Table'[TYPE] = MAX ( 'Table'[TYPE] )
                        && 'Table'[Question] = 5
                )
                    || (
                        'Table'[TYPE] = MAX ( 'Table'[TYPE] )
                            && 'Table'[Question] = 6
                    )
            )
        )
    )
    

     

    Output refer:

     

    You can adapt my Dax. to your specific environment.

     

    Did I answer your question? Mark my post as a solution!


    Best Regards

    Lucien