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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
JajatiDev
Helper II
Helper II

Excel Formula to DAX

Hi,

I have the following excel formula, that retains the following values;

 

Allocated

Pending Allocation

Partial Allocation

In Production

 

IF(OR([status]="Production",[status]="FactShipped"),"In Production",
IF(AND([[delivery_type]]="ship as available",[[order_qty]]=[[confirmed_qty]]),"Allocated",
IF(AND([[delivery_type]]="ship as available",[[confirmed_qty]]>0,[[confirmed_qty]]<[[order_qty]]),"Partial Allocation",
IF(AND([[delivery_type]]="full order consolidation",SUMIF([order_no],[[order_no]],[order_qty])=SUMIF([order_no],[[order_no]],[confirmed_qty])),"Allocated",
IF(AND([[delivery_type]]="full order consolidation",SUMIF([order_no],[[order_no]],[confirmed_qty])>0,SUMIF([order_no],[[order_no]],[confirmed_qty])<SUMIF([order_no],[[order_no]],[order_qty])),"Partial Allocation","Pending Allocation")))))

 

My efforts are to add a column in the power bi report that would capture the result based on the logic. The excel formula looks at multiple fields to retain the above-mentioned values.

 

Thanks and Regards,

Jajati Dev

1 ACCEPTED SOLUTION
JajatiDev
Helper II
Helper II

Hi,

I was able to replicate the formula.

 

Order Status =
IF(OR('Orders'[status]="Production",'Orders'[status]="FactShipped"),"In Production",
IF(AND('Orders'[delivery_type]="Ship as available",'Orders'[order_qty]='Orders'[confirmed_qty]),"Allocated",
IF('Orders'[delivery_type]="Ship as available" && 'Orders'[confirmed_qty]>0,"Partial Allocation",
IF('Orders'[delivery_type]="Full order consolidation" && SUMX(FILTER('Orders','Orders'[order_no]=EARLIER('Orders'[order_no])),'Orders'[order_qty])=SUMX(FILTER('Orders','Orders'[order_no]=EARLIER('Orders'[order_no])),'Orders'[confirmed_qty]),"Allocated",
IF('Orders'[delivery_type]="Full order consolidation" && SUMX(FILTER('Orders','Orders'[order_no]=EARLIER('Orders '[order_no])),'Orders'[confirmed_qty])>0 ,"Partial Allocation",
"Pending Allocation")))))
 
Now the next step for me is to code this in M Language.
 
Thanks,
Dev

View solution in original post

6 REPLIES 6
JajatiDev
Helper II
Helper II

Hi,

I was able to replicate the formula.

 

Order Status =
IF(OR('Orders'[status]="Production",'Orders'[status]="FactShipped"),"In Production",
IF(AND('Orders'[delivery_type]="Ship as available",'Orders'[order_qty]='Orders'[confirmed_qty]),"Allocated",
IF('Orders'[delivery_type]="Ship as available" && 'Orders'[confirmed_qty]>0,"Partial Allocation",
IF('Orders'[delivery_type]="Full order consolidation" && SUMX(FILTER('Orders','Orders'[order_no]=EARLIER('Orders'[order_no])),'Orders'[order_qty])=SUMX(FILTER('Orders','Orders'[order_no]=EARLIER('Orders'[order_no])),'Orders'[confirmed_qty]),"Allocated",
IF('Orders'[delivery_type]="Full order consolidation" && SUMX(FILTER('Orders','Orders'[order_no]=EARLIER('Orders '[order_no])),'Orders'[confirmed_qty])>0 ,"Partial Allocation",
"Pending Allocation")))))
 
Now the next step for me is to code this in M Language.
 
Thanks,
Dev
AliceW
Power Participant
Power Participant

Why don't you create two measures for the two SUMIFs using CALCULATE?

Then you could just include them in the column/measure you want to build.

Hi,

I am not calculating anything here. The SUMIF you see are part of the logic statement to retain a text at the end.

 

The logic is meant to retain the following;

Allocated

Pending Allocation

Partial Allocation

In Production

 

This logic in excel looks at every table row of the specified fields to provide a consolidated order status.

 

I'm guessing you want a calculated column?

Do you  have different tables? SUMIF seems to indicate at least two? If yes, why not connect them using ORDER NUMBER? Then you can just apply an IF(RELATED...).

selimovd
Super User
Super User

Hey @JajatiDev ,

 

Power BI is not Excel.

What do you want to do? Add column? Create a measure? What should the SUMIF represent? The sum on a row level? The sum for a specific column?

 

Please tell us how your table looks like and what you want as a result and then it's easier to help you.

 

Best regards

Denis

Hi,

Yes, I do acknowledge Power BI is different from Excel.

All that I am trying to achieve is to add a column in the report replicating the excel formula to retain the text value.

 

Thanks and Regards,

Jajati Dev

Helpful resources

Announcements
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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