Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

What is the problem with my function?

Hey All, 
 
I am facing an issue regarding the IF function in DAX. I want to calculate the following : if 'SURFACE INV DATA SOURCE'[SLA - PROCESSED is Late then SURFACE INV DATA SOURCE'[SENT TO EZPAY] - SURFACE INV DATA SOURCE'[RECEIVED/DOWNLOADED else Null
 
I dont know what is the problem, could you please help me? 
 
This is my finction:
 
PROCESSED DAYS = IF('SURFACE INV DATA SOURCE'[SLA - PROCESSED]="Late",DATEDIFF('SURFACE INV DATA SOURCE'[SENT TO EZPAY],'SURFACE INV DATA SOURCE'[RECEIVED/DOWNLOADED],DAY),null)
 
Thank you. 
  • Anonymous I guess you are getting error because of null, there is no NULL in DAX functions but instead it is BLANK()

     

    try this:

     

    PROCESSED DAYS = IF('SURFACE INV DATA SOURCE'[SLA - PROCESSED]="Late",DATEDIFF('SURFACE INV DATA SOURCE'[SENT TO EZPAY],'SURFACE INV DATA SOURCE'[RECEIVED/DOWNLOADED],DAY))

     

    You don't need to pass a value for else if will be treated as blank, but if you need another value, you can pass that in else part of the if condition.

     

    Follow us on LinkedIn

     

    Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

     

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

     

1 Reply

  • Anonymous I guess you are getting error because of null, there is no NULL in DAX functions but instead it is BLANK()

     

    try this:

     

    PROCESSED DAYS = IF('SURFACE INV DATA SOURCE'[SLA - PROCESSED]="Late",DATEDIFF('SURFACE INV DATA SOURCE'[SENT TO EZPAY],'SURFACE INV DATA SOURCE'[RECEIVED/DOWNLOADED],DAY))

     

    You don't need to pass a value for else if will be treated as blank, but if you need another value, you can pass that in else part of the if condition.

     

    Follow us on LinkedIn

     

    Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

     

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.