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

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

Reply
cdawidow
Helper III
Helper III

Dynamically Using SUM X for allselected values

Hi guys I have a simple measure called Average Sales = AVERAGEX(VALUES(FISCAL YEAR),TOTAL SALES))

Which is essentially calculating the average of total sales across all present years. 

 

The formula works as expected, but I find that my totals are being calculated as the average and not the sum of any column values I select.   So I have been using Sumx(values("any column field"))

 

My question is, I am using around 3 column fields as my values with this sumx calculation to get the sum of all average sales of all the selected values and I am having to create a sumx calculation for each.  Is there a way to create only 1 sumx calculation witht he ability to sum x all selected values?? 

3 REPLIES 3
daxer-almighty
Solution Sage
Solution Sage

[Sum of Avg Sales Over Column] =
SUMX(
    DISTINCT( Dimension[Column] ), // use VALUES if you've got RI problems
    CALCULATE(
        AVERAGE( FactTable[Sales Amount] )
    )
)

// HASONEVALUE is redundant in 
// your code since if there's only
// one T[Column] value visible
// in the current context, SUMX
// will sum up over just one value.
cdawidow
Helper III
Helper III

Thanks for the response.  Yes, I understand that values removes duplicates. 

 

But lets say I have 2 columns each with unique values ( Customers and Products) along with my average sales measure stated above.

 

Is there a way to build  a sumx calculation that follows the following rules:

 

If(Hasonevalue( column name),average sales, sumx(column name),average sales) 

daxer-almighty
Solution Sage
Solution Sage

Most likely your formula like SUM( VALUES( "any column field" ) ) is incorrect. VALUES removes duplicates which means that if you have 2 records in a table that have the same value in the field, the value will only be counted once in SUM. Don't think this is what you'd want.

 

The rest of the post is not within my grasp.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.