Forum Discussion

Yucy's avatar
Yucy
Icon for Helper I rankHelper I
6 years ago
Solved

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:

 

  • 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 

     

8 Replies

  • 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's avatar
      Yucy
      Icon for Helper I rankHelper I

      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

      • amitchandak's avatar
        amitchandak
        Icon for Super User rankSuper User

        Yucy 

        Can you provide data in table format?

         

        if you need more help mark me @

        Appreciate your Kudos.

         

  • v-yuta-msft's avatar
    v-yuta-msft
    Icon for Community Support rankCommunity Support

    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's avatar
      Yucy
      Icon for Helper I rankHelper I

      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,