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
joshua1990
Post Prodigy
Post Prodigy

Complex SUM MAX measure

Hey community!

I have a table like this:

OrderDateState 1State 2CodeQuantity
55995501.02.20201001X500
55995502.02.20202501 200
55995502.02.20202502X250
55995502.02.20204501 200
55995502.02.20204502 200
55995503.02.20206002 450

 

This table shows me per Order level the corresponding manufacturing routing.

State 1 is the sequence for the process step and State 2 is the factor, if the step is finished (2) or is started (1).

Now I would like to get the SUM for quantity for the last process step (State 1).

That means I need to sum up the column "Quantity" per "State 1.

In addition, these filters should be set:

  • Code = BLANK()
  • State 1 = 450 > 600
    • That means, the last step is 450 and not 600

 How can this dax measure be build?

This is my first try:

 

 

1. Try = 
VAR _State1 =
    MAXX (
        ALLSELECTED ( 'Routing' ),
        'Routing'[State 1]
    )
RETURN  
MAXX(
    FILTER(
        'Routing',
        'Routing'[Code] = BLANK()
            && 'Routing'[State 1] = _State1 
    ),
    'Routing'[Quantity]
)

 

 

 

Is an iteration function like MAXX here appropriate?

How can I add, that '450' for State1 is above '600' ?

 

 

 

2 REPLIES 2
amitchandak
Super User
Super User

@joshua1990 , what is expected output

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak : thanks! In the example above the result is = 400 (State1 = 450; 200 +200)

 

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.