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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Goldfinch
New Member

DAX - calculate the total based on average country value and per year

Hi Guys,

 

For a project, I'm trying to show the total amount of sales. This total is dependent on the selected years (e.g. 2018 and 2019) and is always made for all countries in one box showing 1 total number. I've had some problems with getting the two criteria to work being (i) Year and (ii) Country code.

 

The amount need to be summed based on the years selected and all countries. Sometimes a country code will appear multiple times for 1 year because multiple entities are located in the same country but the sales amount is on country level so appears 3 times when you have for example 3 entities - see BE where you have 3x the country total sale amount.

 

I was tried making an average of the amounts based on country code and then using and SUMX and hasonevalue to get the total amount. But the hasonevalue only takes 1 criteria and does not take into account each year selected but delivers a total for all years - same problem if I reverse it.

 

Does anyone have any idea on how to tackle this?

 

Var_YearVar_Country codeSales amount
2018BE2.000
2018BE2.000
2018BE2.000
2019BE4.000
2019BE4.000
2019BE4.000
2018FR500
2019FR7.000
2018GB1.000
2019GB3.000

 

1 ACCEPTED SOLUTION
daXtreme
Solution Sage
Solution Sage

[Total] =
    SUMX(
        DISTINCT( T ),
        T[Sales Amount]
    )

View solution in original post

1 REPLY 1
daXtreme
Solution Sage
Solution Sage

[Total] =
    SUMX(
        DISTINCT( T ),
        T[Sales Amount]
    )

Helpful resources

Announcements
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!

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.