Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Rob_7153
Frequent Visitor

Power Bi Measure Percentage Difference between Column total and row total

Hi everyone,
i know there are a variety of posts on this but I couldn't seem to find one that had the solution that I was looking for... I'm hoping one of your wonderful minds can help me out.

 

Here is my problem: In a Power Bi Matrix, that shows an Avg. per domain for each month, i want to create an additional column that shows the percentage difference between the domain average each month and the Total Avg. of the column for the same month.


For Example the columns D, F, H and J:
Delta Column.PNG


Unfortunately i can't find a solution how to get this in my Power Bi matrix. All i can get is the following matrix:
Power Bi Matrix.PNG

I tried to find a measure or quick measure to get me the desired column, but without success.

Every help on how to fix my problem is much appreciated!


Thanks in advance 🙂


Best Regards,

Rob_7153

 

 

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @Rob_7153 ,

 

A simple sample:

Icey_0-1652333989940.png

Icey_1-1652334084739.png

Avg = 
VAR Avg_ =
    AVERAGE ( 'Table'[Value] )
VAR Avg_Domain =
    CALCULATE ( AVERAGE ( 'Table'[Value] ), ALLSELECTED ( 'Table'[Domains] ) )
VAR Avg_Month =
    CALCULATE ( AVERAGE ( 'Table'[Value] ), ALLSELECTED ( 'Table'[Month] ) )
VAR Avg_all =
    CALCULATE (
        AVERAGE ( 'Table'[Value] ),
        ALLSELECTED ( 'Table'[Domains] ),
        ALLSELECTED ( 'Table'[Month] )
    )
RETURN
    SWITCH (
        TRUE (),
        HASONEFILTER ( 'Table'[Month] ) && HASONEFILTER ( 'Table'[Domains] ), Avg_,
        HASONEFILTER ( 'Table'[Month] ), Avg_Domain,
        HASONEFILTER ( 'Table'[Domains] ), Avg_Month,
        Avg_all
    )
Delta = 
VAR Avg_ =
    AVERAGE ( 'Table'[Value] )
VAR Avg_Domain =
    CALCULATE ( AVERAGE ( 'Table'[Value] ), ALLSELECTED ( 'Table'[Domains] ) )
RETURN
    IF ( HASONEFILTER ( 'Table'[Domains] ), Avg_ - Avg_Domain )

 

 

Best Regards,

Icey

 

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

View solution in original post

2 REPLIES 2
Icey
Community Support
Community Support

Hi @Rob_7153 ,

 

A simple sample:

Icey_0-1652333989940.png

Icey_1-1652334084739.png

Avg = 
VAR Avg_ =
    AVERAGE ( 'Table'[Value] )
VAR Avg_Domain =
    CALCULATE ( AVERAGE ( 'Table'[Value] ), ALLSELECTED ( 'Table'[Domains] ) )
VAR Avg_Month =
    CALCULATE ( AVERAGE ( 'Table'[Value] ), ALLSELECTED ( 'Table'[Month] ) )
VAR Avg_all =
    CALCULATE (
        AVERAGE ( 'Table'[Value] ),
        ALLSELECTED ( 'Table'[Domains] ),
        ALLSELECTED ( 'Table'[Month] )
    )
RETURN
    SWITCH (
        TRUE (),
        HASONEFILTER ( 'Table'[Month] ) && HASONEFILTER ( 'Table'[Domains] ), Avg_,
        HASONEFILTER ( 'Table'[Month] ), Avg_Domain,
        HASONEFILTER ( 'Table'[Domains] ), Avg_Month,
        Avg_all
    )
Delta = 
VAR Avg_ =
    AVERAGE ( 'Table'[Value] )
VAR Avg_Domain =
    CALCULATE ( AVERAGE ( 'Table'[Value] ), ALLSELECTED ( 'Table'[Domains] ) )
RETURN
    IF ( HASONEFILTER ( 'Table'[Domains] ), Avg_ - Avg_Domain )

 

 

Best Regards,

Icey

 

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

Rob_7153
Frequent Visitor

Hi Icey,

thank you for your input and your time!

It works now, you gave me the input that i needed. Since i also have sub-domains i had to adjust the Var Avg-domain code as followed:

Var Avg_Domain= Calculate( AVERAGE ( 'Table'[Value] ), ALLSELECTED ( 'Table'[Domains], 'Table'[Sub-Domains])) 


Have a great day,

Rob_7153

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.