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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
FelipMark
Helper II
Helper II

Measure in DAX to represent sales in the customer's state

Hi everyone, I have a problem.

I have the following database:

FelipMark_0-1683337846887.png

 

I want to create a measure that returns the % of sales of each customer within their state but I don't know how. Can anyone help me??

1 ACCEPTED SOLUTION

hi @FelipMark 

just noticed you expected a measure, try like:

measure = 
DIVIDE(
    SUM(data[SALE]),    
    SUMX(
        FILTER(
            ALL(data),
            data[State]=MAX(data[State])
        ),
        data[Sale]
    )
)

it worked like:

FreemanZ_0-1683343269967.png

View solution in original post

4 REPLIES 4
FreemanZ
Super User
Super User

hi @FelipMark 

try to add a calculated column like:

Column = 
DIVIDE(
    [SALE],    
    SUMX(
        FILTER(
            data,
            data[State]=EARLIER(data[State])
        ),
        data[Sale]
    )
)

it worked like:

FreemanZ_0-1683339212031.png

Is that so?

not working, the error says the following:
EARLIER/EARLIEST references a previous row context that does not exist.

FelipMark_0-1683341720948.png

 

 

hi @FelipMark 

just noticed you expected a measure, try like:

measure = 
DIVIDE(
    SUM(data[SALE]),    
    SUMX(
        FILTER(
            ALL(data),
            data[State]=MAX(data[State])
        ),
        data[Sale]
    )
)

it worked like:

FreemanZ_0-1683343269967.png

It worked! Thanks

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.