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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
_mathew_
New Member

Calculate the mean value based on n% of the maximum value of another variable in the table

Hi all,

 

Based on the table, I want to determine the average value of Value2 (channel "y") per product in the range defined as n% (e.g. 30%) of the maximum value of Value1 (channel "x"). How can I do it with a DAX measure? 

 

ProductSubproductChannelValue1Value2
AB1x3728 
AB1y 22
AB2x4117 
AB2y 57
ABA3x5379 
ABA3y 121
ABA4x1202 
ABA4y 46
ABA8x4888 
ABA8y 78
AC11x7635 
AC11y 32
AC14x2583 
AC14y 61
AC163x1792 
AC163y 59

 

 

Thanks for sharing your ideas!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @_mathew_,

You can try to use the following measure formula to get the difference between different sub categories:

 

formula =
VAR v1 =
    CALCULATE (
        MAX ( 'Table'[Value1] ),
        FILTER ( ALLSELECTED ( 'Table' ), [Channel] = "x" ),
        VALUES ( 'Table'[Product] )
    )
VAR v2 =
    CALCULATE (
        AVERAGE ( 'Table'[Value2] ),
        FILTER ( ALLSELECTED ( 'Table' ), [Channel] = "y" ),
        VALUES ( 'Table'[Product] ),
        VALUES ( 'Table'[Subproduct] )
    )
RETURN
    DIVIDE ( v2, v1 )

 

Regards,

Xiaoxin Sheng

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @_mathew_,

You can try to use the following measure formula to get the difference between different sub categories:

 

formula =
VAR v1 =
    CALCULATE (
        MAX ( 'Table'[Value1] ),
        FILTER ( ALLSELECTED ( 'Table' ), [Channel] = "x" ),
        VALUES ( 'Table'[Product] )
    )
VAR v2 =
    CALCULATE (
        AVERAGE ( 'Table'[Value2] ),
        FILTER ( ALLSELECTED ( 'Table' ), [Channel] = "y" ),
        VALUES ( 'Table'[Product] ),
        VALUES ( 'Table'[Subproduct] )
    )
RETURN
    DIVIDE ( v2, v1 )

 

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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