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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.