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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
joshua1990
Post Prodigy
Post Prodigy

Calculated Column - Last Entry per Sales Order

Hi experts!

I have a table that shows me the value for each sales order for the respective state:

Order NumberStatusValue
100505
100665
100804
10095 
101505

 

As you can there are missing entries in the column Value.

I would like to create a calculated column that shows me per sales order for blank entries the last entry based on column status.

But how?

1 ACCEPTED SOLUTION

Hi @joshua1990 

Dhacd_0-1657636404172.png

 



Try the below code

NullValueFill = 
Var _Status = 'Table'[Status]
Var _Value ='Table'[Value]
Var _PreviousStatus = maxx(filter('Table','Table'[Status]<_Status),'Table'[Status])
Var _PreviousValue = CALCULATE(Max('Table'[Value]),filter('Table','Table'[Status]=_PreviousStatus))
Var result = If(isblank(_Value),_PreviousValue,_Value)
Return result

If there is any issue please reply.

If this post helps, then please consider accepting it as the solution to help the other members find it more quickly.
Regards,
Atma.

View solution in original post

3 REPLIES 3
Dhacd
Resolver III
Resolver III

Hi @joshua1990,
Just to check whether we are on the same page, 
In this context you want the blank row to have the value of previous number status but same order id
That is 4.
If this is what you are trying to achieve it is possible.
Reply whether I understood your problem correctly or not.
Regards,

Atma.

@Dhacd : Exactly!

Hi @joshua1990 

Dhacd_0-1657636404172.png

 



Try the below code

NullValueFill = 
Var _Status = 'Table'[Status]
Var _Value ='Table'[Value]
Var _PreviousStatus = maxx(filter('Table','Table'[Status]<_Status),'Table'[Status])
Var _PreviousValue = CALCULATE(Max('Table'[Value]),filter('Table','Table'[Status]=_PreviousStatus))
Var result = If(isblank(_Value),_PreviousValue,_Value)
Return result

If there is any issue please reply.

If this post helps, then please consider accepting it as the solution to help the other members find it more quickly.
Regards,
Atma.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.