Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Hi,
I would like to calculate the number of days between two dates in a column.
I have now solved this:
= Duration.Days([M2.A Forecast Date] - [M1 Forecast Date])
But how can I add that this is only calculated if none of the dates is empty? Then I would also like an empty cell.
Can someone maybe help me with this?
Thanks a lot!
Nobody
Solved! Go to Solution.
Try the following formula as you are using Power Query:
if [M2.A Forecast Date] = null or [M1 Forecast Date] = null then null else Duration.Days([M2.A Forecast Date] - [M1 Forecast Date])
Hi Nobody
We want to help you but it looks like you asked this question in a rush.
It does not make sense. "how can I add that this is only calculated if none of the dates is empty" ☹️
Please take time to write questions clearly and you will get quicker answers. Thanks 😀
HI
Pleasr try :
Try the following formula as you are using Power Query:
if [M2.A Forecast Date] = null or [M1 Forecast Date] = null then null else Duration.Days([M2.A Forecast Date] - [M1 Forecast Date])
thank you, it works 🙂
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 58 | |
| 53 | |
| 43 | |
| 17 | |
| 16 |
| User | Count |
|---|---|
| 123 | |
| 108 | |
| 44 | |
| 32 | |
| 24 |