Forum Discussion

GarethW's avatar
GarethW
Frequent Visitor
6 years ago
Solved

Conditional formatting of Matrix based on Total average

Hello I am new to PowerBI and am in the process of migrating old manual reports to it.   One of these reports shows share of sales, by month (column) by product type (rows).   This has a hea...
  • MFelix's avatar
    MFelix
    6 years ago

    Hi GarethW ,

     

    First of all let me apologize for the late response I must have missed this post on the multiple notifications I have.

     

    What I think I was abble to get it to work I have created 3 measures (this simplifies the tough process):

    % per category/month =
    DIVIDE (
        COUNT ( 'Table'[Region] );
        CALCULATE ( COUNT ( 'Table'[Region] ); ALLSELECTED ( 'Table'[Region] ) )
    )
    
    
    
    % Total/region =
    VAR temp_table =
        FILTER (
            SUMMARIZE (
                ALLSELECTED ( 'Table' );
                'Table'[Region];
                "@count"; COUNT ( 'Table'[Region] )
            );
            'Table'[Region] = MAX ( 'Table'[Region] )
        )
    VAR total_table =
        SUMMARIZE (
            ALLSELECTED ( 'Table' );
            'Table'[Region];
            "@count"; COUNT ( 'Table'[Region] )
        )
    RETURN
        DIVIDE ( SUMX ( temp_table; [@count] ); SUMX ( total_table; [@count] ) )
    
    
    
    % variation = [% per category/month]-[% Total/region]

     

    Now use the last measure to create your condittional formatting.

     

    As you can see on the image below the values that are equal to the region total are blank below are red and above are green.

     

    Check also the PBIX file attached.

     

    Once more I'm very sorry for the delay in the answer.