Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi Everyone,
I am not sure what is going on with the IF function but it is not working as I would expected to. I want to get the number of days between two dates if a certain condition is met. If the condition is not met I want it get me the number of days that have passed.
This is my current formula.
| Customer | Status | Return Date | Shipping Date | DateDiff |
| A | Closed | 1/28/2019 | 2/1/2019 | 4 |
| B | Active | 2/4/2019 | 4 | |
| C | Active | 4 | ||
| D | Active | 2/4/2019 | 4 |
How do I get it to output the correct value?
Note: When I take out the IF function and seperate the DATEDIFF functions the output is correct.
Solved! Go to Solution.
HI @amlopez45,
Can you please share pbix file for test? Your formula works well on my side.
Regards,
Xiaoxin Sheng
HI @amlopez45,
Can you please share pbix file for test? Your formula works well on my side.
Regards,
Xiaoxin Sheng
Hi @Anonymous,
The formula is working well now. I tried Collins method and it seemed to do the job. Not really sure what happened. Thank you for offering to help. ![]()
Hi Everyone,
I am not sure what is going on with the IF function but it is not working as I would expected to. I want to get the number of days between two dates if a certain condition is met. If the condition is not met I want it get me the number of days that have passed.
This is my current formula.
| Customer | Status | Return Date | Shipping Date | DateDiff |
| A | Closed | 1/28/2019 | 2/1/2019 | 4 |
| B | Active | 2/4/2019 | 4 | |
| C | Active | 4 | ||
| D | Active | 2/4/2019 | 4 |
How do I get it to output the correct value?
Note: When I take out the IF function and seperate the DATEDIFF functions the output is correct.
hello @amlopez45
first things first, try changing your data format (top of modeling tab) to date for your calculated column and see if that fixes your issue
here is a picture of what I did.
best regards,
Collin
Hello @Anonymous,
Thank you for the suggestion, the formula is working well now. ![]()
Great to hear, be sure to mark the post as the solution for anyone else that comes along.
best Regards,
Collin
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 48 | |
| 45 | |
| 41 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 69 | |
| 64 | |
| 32 | |
| 31 | |
| 27 |