• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Date diff

gauran

New Member
Hi
I want to mimic the formula in power bi from Excel. But not too sure how to do this. the main formula used in Excel in column to DUE is =IF([@PromiseDt]=0,"Uncommitted",[@PromiseDt]-MAX(TODAY(),[@DueDate]))

DueDateFirst PromisePromiseDtto Due
27-Jan-2022Uncommitted
01-Feb-202222-Apr-202222-Apr-2022-5.00
15-Mar-202222-Apr-202222-Apr-2022-5.00
14-Feb-202222-Apr-202222-Apr-2022-5.00
17-Apr-202206-May-202206-May-20229.00
08-Aug-202208-Aug-202208-Aug-20220.00
12-Jul-202212-Jul-202212-Jul-20220.00
11-Apr-202222-Apr-202222-Apr-2022-5.00
20-Sep-202220-Sep-202220-Sep-20220.00
18-Oct-202218-Oct-202218-Oct-20220.00
17-Mar-202317-Mar-202317-Mar-20230.00
11-Jan-202311-Jan-202311-Jan-20230.00
12-Oct-202227-Apr-202227-Apr-2022-168.00
12-Oct-202212-Oct-202212-Oct-20220.00
08-Aug-202208-Aug-202208-Aug-20220.00
21-Sep-202221-Sep-202221-Sep-20220.00
31-May-202231-May-202231-May-20220.00
25-Apr-202225-Apr-202225-Apr-2022-2.00
21-Jun-202221-Jun-202221-Jun-20220.00
12-Jul-202212-Jul-202212-Jul-20220.00
25-Apr-202225-Apr-202225-Apr-2022-2.00
25-Apr-202225-Apr-202225-Apr-2022-2.00
17-Apr-202218-May-202218-May-202221.00
20-May-202225-May-202225-May-20225.00
14-Jun-202214-Jun-202214-Jun-20220.00
28-Jun-202228-Jun-202228-Jun-20220.00
26-Aug-202226-Aug-202226-Aug-20220.00
27-Apr-202231-May-202231-May-202234.00
07-Sep-202207-Sep-202207-Sep-20220.00
07-Jun-202212-Jul-202212-Jul-202235.00
 
Personally, I'd recommend doing calculation in M code (power query) stage. About 90% of calculated columns are more efficient in PQ when compared to DAX calculated columns (especially when it's within single table context).

Also, I'm not a fan of mixing numeric and text values in single column. This will add unnecessary overhead during subsequent analysis/calculation.

M code for custom column.
Code:
= if [PromiseDt] = null then null else Duration.Days([PromiseDt] - List.Max({DateTime.Date(DateTime.FixedLocalNow()),[DueDate]}))
 
Back
Top