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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

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
Community Champion
Community Champion

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
Community Champion
Community Champion

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

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.