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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
learner03
Post Partisan
Post Partisan

If condition issue

How can write a DAX for below to get desired result in Result whole order fulfil column-

So, if for an order no., 'can fulfil' column is same for all items, then 1 otherwise 0 if even one item in that order is having 0 on can fulfil column. So, 1 will indicate that whole order can go together otherwise can't.

 

      
 order no.itemcan fulfilResult whole order fufil 
 A12311 
 A34511 
 B34510 
 B12300 
 C45600 
 C78910 
 C23400 
 D45611 
 E28700 
 E12300 
 F35600 
2 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood correctly your question, because I am confused about order number E and F.

However, please check the below picture and the attached pbix file. It shows the same result as yours.

Picture3.png

 

Result whole order fulfil CC = 
VAR currentorderno = Data[order no.]
VAR filtertable =
    FILTER ( Data, Data[order no.] = currentorderno && Data[can fulfil] <> 1 )
RETURN
    IF ( COUNTROWS ( filtertable ) > 0, 0, 1 )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

Samarth_18
Community Champion
Community Champion

Hi @learner03 ,

 

You can also try this:-

Result whole order fufil = 
var result = COUNTROWS(FILTER('Table','Table'[order no.] = EARLIER('Table'[order no.]) && 'Table'[can fulfil] = 0))
return IF(ISBLANK(result),1,0)

output:-

 

Samarth_18_0-1648535081207.png

 

Thanks,

Samarth

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

View solution in original post

2 REPLIES 2
Samarth_18
Community Champion
Community Champion

Hi @learner03 ,

 

You can also try this:-

Result whole order fufil = 
var result = COUNTROWS(FILTER('Table','Table'[order no.] = EARLIER('Table'[order no.]) && 'Table'[can fulfil] = 0))
return IF(ISBLANK(result),1,0)

output:-

 

Samarth_18_0-1648535081207.png

 

Thanks,

Samarth

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood correctly your question, because I am confused about order number E and F.

However, please check the below picture and the attached pbix file. It shows the same result as yours.

Picture3.png

 

Result whole order fulfil CC = 
VAR currentorderno = Data[order no.]
VAR filtertable =
    FILTER ( Data, Data[order no.] = currentorderno && Data[can fulfil] <> 1 )
RETURN
    IF ( COUNTROWS ( filtertable ) > 0, 0, 1 )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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