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 am trying to create new column to show difference with days between two dates through Power Query but I am not getting expected results. I have 2 columns DOJ(Date of Joining) and DOL(Date of Leaving). If DOJ date column is blank then use Today's date minus DOL else DOJ minus DOL . I tried 2 different ways, 1) with Custom Column 2) Date calculate Age and then edited . They both are giving me same results.
= Table.AddColumn(#"Removed Columns", "Custom", each if [DOJ New Joiner] = null then Date.From(DateTime.LocalNow())-[DOL] else [DOJ New Joiner] - [DOL])
= Table.AddColumn(#"Added Custom", "Age", each if [DOJ New Joiner] = null then Date.From(DateTime.LocalNow()) - [DOL] else [DOJ New Joiner]-[DOL])
Hi @amol0512 ,
Has your problem been solved, if so, please consider Accept a correct reply as the solution or share your own solution to help others find it.
Best Regards
Lucien
@amol0512 , seem correct , Try like
Duration.Days(if [DOJ New Joiner] = null then Date.From(DateTime.LocalNow()) - [DOL] else [DOJ New Joiner]-[DOL])
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 |
|---|---|
| 56 | |
| 53 | |
| 40 | |
| 17 | |
| 16 |
| User | Count |
|---|---|
| 116 | |
| 107 | |
| 42 | |
| 32 | |
| 26 |