Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

IF STATEMENT

I wonder why this does not work:

 

Status 2 = IF('DailyASCPPlan Data'[ORDER_TYPE_TEXT] = "Planned order demand" && ISBLANK('DailyASCPPlan Data'[PROJECT_NUMBER]),"Planned","Ordered")

 

  • Anonymous , This is column can you show in the table view?

     

    Also, check if PROJECT_NUMBER is text, check is it a empty string ""

6 Replies

  • Try this one: 

     

     

    Status 2 = 
    var order_type = SELECTEDVALUE('DailyASCPPlan Data'[ORDER_TYPE_TEXT])
    var is_blank = ISBLANK('DailyASCPPlan Data'[PROJECT_NUMBER])
    
    return
    IF( order_type = "Planned order demand" && is_blank,
          "Planned",
          "Ordered")

     

     

    Nevertheless, it may be best to create a "Calculated Column" or a "Custom column" in Power Query.

    Hope this answer solves your problem! If you need any additional help please tag me in your reply.
    If my reply provided you with a solution, pleased mark it as a solution ✔️ or give it a kudoe 👍
    Thanks!

    Best regards,
    Gonçalo Geraldes

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you so much. I appreciate your help. This actually works. Tho i just found out that the actual value is not really blank, rather a "". so i did not use isblank and rather evaluate if field = "".

  • selimovd's avatar
    selimovd
    Most Valuable Professional

    Hey Anonymous ,

     

    it looks like it works, but I guess you expected a different result 😉

     

    In Power BI you can add a calculated column, that's just a new column in the table. A calculated table is calculated when the file is loaded and then fix. The value won't change based on slicers.

    Or you can use a measure. A measure always needs a context and is calculated based on this context.

     

    Based on your formula I guess you used a calculated column.

    In your screenshot you used a matrix, so rows might be hidden based on your selection.

     

    To see if all of your values are existing, go to the Data tab and check the result in the complete table there:

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
     
    Best regards
    Denis
     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      selimovd Thank you so much. I appreciate your help. This actually works. Tho i just found out that the actual value is not really blank, rather a "". so i did not use isblank and rather evaluate if field = "".

  • Anonymous , This is column can you show in the table view?

     

    Also, check if PROJECT_NUMBER is text, check is it a empty string ""

    • Anonymous's avatar
      Anonymous
      Not applicable

      Right. It's "" not blank. thanks for the info!