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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

DAX Logical statement and filter logic

Hello to everyone i have to solve this problem and i dont' konw how to start. 

 

Basicly i ve  created a calculed column if setting if  order il fullfilled or not but with a specific rule explained below:

 

I have two table involved:

 

Table name

 called : order_dtl 

 

in the tableorder_dtl   i have the single items [order_line] that merge   built an order [order_ID]

 

Table order_dtl 

 

Field 

 

 

Order_Id                                          

Order_Line                                  

(items)

Status ofoperation 
                                                                   
IsFullfilled_notFullfilled
1a1ship 
1a2ship 
1a3ship 
2a4ship 
2a5waiting 
2a6waiting 
3a7ship 
3a8waiting 

 

Now basicly i want create a calculed column named Isfullfiled_notfullfilled where if for each order ID all the relative  status operation are ship insert Ship but if just one of that are witing wrote for everyone not fullfilled. 

 

The result that i expected is the following table 

Order_Id                      Order_Line                                            
( items)
Status of operation                         IsFullfilled_notFullfilled
1a1shipship
1a2shipship 
1a3shipship
2a4shipnotship
2a5shipnotship
2a6waitingnotship
3a7ship

notship 

 

3a8waitingnotship

 

 

i am junior in DAX and i don't know how to set the calculed column "IsFullfilled_notFullfilled" in order to obtain the result above using if condition.

 

My final achive should be mesure counting  the number of fullfilled e not fullfilled based on the calculed column [IsFullfilled_notFullfilled]

Thanks so much in advace for your help, i really appreciate it 

 

Regard 

 

John 

3 REPLIES 3
lbendlin
Super User
Super User

So basically for each order you want to find out if at least one order line is still in "waiting" status which means the order is not completely fulfilled.

 

Do you want to try to find the DAX for this yourself, or would you like some guidance?

Anonymous
Not applicable

 

Yes,  for each order i  want to find out if at least one order line is still in "waiting" status which means the order is not completely fulfilled and in this case every order line must be cosiderated as "waiting" in the calculed column while if every order line is fullfilled also the order is fullfilled. 

 

I don't know firstly if is possible create a calculated column with this conditions and as second the relative DAX expression, i try to start with a formula like

 

If [Status of operation]="shipped", "fullfilled", "waiting"  ==> but i don't know how group that with the condition     "if at least one order line is still in "waiting" status it means that the  order is not completely fulfilled and in this case every order line must be cosiderated as "waiting" in the calculed column while if every order line is fullfilled also the order is "fullfilled".

 

Really it is a nighmare is you can help me, i really appreciate

 

 

Don't despair - nearly there. I made you confirm the business statement to make it easier to see how to translate that into DAX.

 

For each order, count the rows in "waiting" status. If that count is zero then the order is "fulfilled", otherwise it is not .

 

Pseudo code for a calculated column 

 

fulfillmentstatus= 

var o =selectedvalue(order)

return if(countrows(filter(orderstable,order = o && status="waiting)),"Fulfilled,"waiting")

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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