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
Anonymous
Not applicable

Dax Aggregation for Country level

Hai All, I need one help on this 

alanpjames_0-1655456852541.png

The above table % Share range is the expecting output
I want  to achieve this logic at the Dax level
Users want to see the % total at the country level
For eg: For DE (18+13+10+2+22) = 65 
18/65*100 = 27.69 For DE For "above target" category 
and for the model number calculation i used DISTINCT COUNT  and model number column is the test data type
Please help me to achieve this logic in dax level

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Anonymous 

Please use the following code

1.png

% Share Range = 
VAR Numerator = [# Model Number]
VAR T1 =
    CALCULATETABLE ( Initiative, ALLEXCEPT ( Initiative, Initiative[Country] ) )
VAR T2 = 
    SUMMARIZE ( T1, Initiative[Country], Initiative[Category] )
VAR T3 =
    ADDCOLUMNS ( T2, "Models", [# Model Number] )
VAR Denominator =
    SUMX ( T3, [Models] )
RETURN
    IF ( HASONEVALUE ( Initiative[Country] ),
        DIVIDE ( Numerator, Denominator ),
        1
    )

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

Hi @Anonymous 

Please use the following code

1.png

% Share Range = 
VAR Numerator = [# Model Number]
VAR T1 =
    CALCULATETABLE ( Initiative, ALLEXCEPT ( Initiative, Initiative[Country] ) )
VAR T2 = 
    SUMMARIZE ( T1, Initiative[Country], Initiative[Category] )
VAR T3 =
    ADDCOLUMNS ( T2, "Models", [# Model Number] )
VAR Denominator =
    SUMX ( T3, [Models] )
RETURN
    IF ( HASONEVALUE ( Initiative[Country] ),
        DIVIDE ( Numerator, Denominator ),
        1
    )
themistoklis
Community Champion
Community Champion

Hello @Anonymous 

 

Create a new measure and add the following formula:

% Share = 
VAR Volume =
    SUM('Table'[Model Number])
VAR AllVolume =
    CALCULATE ( SUM('Table'[Model Number]),ALLSELECTED('Table'[Category]) )

RETURN
    DIVIDE ( Volume, AllVolume )

 

Fie also attached

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.