cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
badger123 Member
Member

Re: Max of Summed Values of a Category

Hi @AlB

 

I don't want to use a slicer for category, I'm looking to do the same as before where an item is selected and the weighted average should be calculated based on the corresponding category. I'm guessing I will need to take a similar approach combining this... 

 

VAR _ItemCategory =
    SELECTEDVALUE ( Table2[Category] )

 

and this... 

 

WeightedAverageGrowthCat =
DIVIDE (
    SUMX ( Table3; Table3[Growth] * Table3[volume] );
    SUM ( Table3[volume] )
)

but don't quite know what that measure would be?!  

Highlighted
Super User
Super User

Re: Max of Summed Values of a Category

@badger123

Yeah you could follow the same logic, or change it a bit:

Table2 is as previously, Table3 the new one that you show with the growth.

 

WeightedAverageGrowthCat_V2 =
VAR _ItemCategory =
    SELECTEDVALUE ( Table2[Category] )
RETURN
    CALCULATE (
        DIVIDE (
            SUMX (
                Table3;
                Table3[Growth] * Table3[volume]
            );
            SUM ( Table3[volume] )
        );
        CALCULATETABLE (
            VALUES ( Table2[ID] );
            Table2[Category] = _ItemCategory;
            ALL ( Table2 )
        )
    )

 

Code formatted with   www.daxformatter.com

badger123 Member
Member

Re: Max of Summed Values of a Category

@AlB Awesome! Thank you so much! Smiley Happy 

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 54 members 1,114 guests
Please welcome our newest community members: