cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Yucy Helper I
Helper I

Need help on if statement DAX

Hello all, 

I have a small table with category and state, I am looking for a new column. Can anyone help? Example is below:

 

example.gif

1 ACCEPTED SOLUTION

Accepted Solutions
Super User IV
Super User IV

Re: Need help on if statement DAX

Try like

Column = var _res = COUNTX(filter(Sheet1,[State]="Resolved" && [Category] =EARLIER([Category])),[Category])+0
return if([State]="Resolved" && _res>0, [State],if([State]="Closed" && _res=0,[State],BLANK()))

 

File attached after signature 

 





Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
In case it does not help, please provide additional information and mark me with @
My Recent Blog -Week is not so Weak Proud to be a Super User! Connect on Linkedin


View solution in original post

8 REPLIES 8
cmilligan262 Helper II
Helper II

Re: Need help on if statement DAX

@Yucy Can you provide more info on why some of the closed values in the state column correspond to a blank and why others correspond to closed

Yucy Helper I
Helper I

Re: Need help on if statement DAX

Sorry, my bad. The closed at new column for category C should be blank, but Closed at new column for category E should be closed because there is no resolved for E, then I want to keep the closed

Super User IV
Super User IV

Re: Need help on if statement DAX

@Yucy 

Can you provide data in table format?

 

if you need more help mark me @

Appreciate your Kudos.

 





Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
In case it does not help, please provide additional information and mark me with @
My Recent Blog -Week is not so Weak Proud to be a Super User! Connect on Linkedin


Community Support
Community Support

Re: Need help on if statement DAX

@Yucy ,

 

I'm still not understand of the logic of how to create 'new column' you mentioned, could you please clarify more details?

 

Regards,

Jimmy Tao

Yucy Helper I
Helper I

Re: Need help on if statement DAX

Thanks, here is the table

CategoryStateNew Column
AResolvedResolved
AResolvedResolved
AClosed 
BResolvedResolved
BClosed 
CResolvedResolved
CClosed 
CClosed 
DResolvedResolved
DResolvedResolved
DClosed 
DResolvedResolved
DResolvedResolved
E  
EClosedClosed

@amitchandak

Yucy Helper I
Helper I

Re: Need help on if statement DAX

Thanks for helping, my table has column A and B, Category and State, I need to insert a new column as column C. my if statement never works,

Super User IV
Super User IV

Re: Need help on if statement DAX

Try like

Column = var _res = COUNTX(filter(Sheet1,[State]="Resolved" && [Category] =EARLIER([Category])),[Category])+0
return if([State]="Resolved" && _res>0, [State],if([State]="Closed" && _res=0,[State],BLANK()))

 

File attached after signature 

 





Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
In case it does not help, please provide additional information and mark me with @
My Recent Blog -Week is not so Weak Proud to be a Super User! Connect on Linkedin


View solution in original post

Yucy Helper I
Helper I

Re: Need help on if statement DAX

Thank you for your help, however, it not working for me,  maybe I did not provide enough data, Here is exactly what I have in my dataset, would you mind have a look again, I am sorry, thanks

case numbervalueOpenedENDColumn
CS0080746Resolved1/20/2020 10:291/20/2020 11:03Closed
CS0080746Resolved1/20/2020 10:291/23/2020 10:38Closed
CS0080746Closed1/20/2020 10:291/31/2020 0:00Closed
CS0080746Resolved1/20/2020 10:291/31/2020 0:00Closed
CS0080772Resolved1/20/2020 10:541/21/2020 14:11Closed
CS0080772Closed1/20/2020 10:542/01/2020 0:00Closed
CS0080772Resolved1/20/2020 10:542/01/2020 0:00Closed
CS0080798Closed1/20/2020 11:181/20/2020 13:22Closed
CS0089655Closed2/13/2020 13:342/13/2020 13:35Closed

@amitchandak

Helpful resources

Announcements
Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

‘Better Together’ Integration Forum Launch

‘Better Together’ Integration Forum Launch

We've launched a how-to forum where you can learn about how Power BI integrates with other Power Platform products.

Top Solution Authors
Top Kudoed Authors