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!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live 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])
The Power BI Data Visualization World Championships is back! It's time to submit your entry.
| User | Count |
|---|---|
| 50 | |
| 42 | |
| 36 | |
| 31 | |
| 29 |
| User | Count |
|---|---|
| 129 | |
| 129 | |
| 59 | |
| 48 | |
| 47 |