Forum Discussion
NETWORKDAYS overriding Variables
Hello,
I was struggling with the new function NETWORKDAYS, that does not give the proper value at total. I insvestigated, and end up, to the following DAX to put in evidence the issue ;
To bypass this issue of inacuracy of NETWORKDAYS at the total line, I came back to the basic,
I skipped the NETWORKDAYS funktion, and count days in a calculated variable table. and chetck that the aggregation worked properly at the end.
Duration in work days from Release date to Last Ship Date2 =Var selection =CALCULATETABLE(FACT_CUSTOMER_ORDER_LINE_C,FILTER(FACT_CUSTOMER_ORDER_LINE_C ,FACT_CUSTOMER_ORDER_LINE_C[Date First Released] <> BLANK()&& FACT_CUSTOMER_ORDER_LINE_C[Date Last Actual Ship] <> BLANK()))VAR list_with_days =ADDCOLUMNS(selection ,"duration work days",COUNTROWS(FILTER(ALL('Calendar'),WEEKDAY('Calendar'[Date],2) <= 5&& 'Calendar'[Date] >= [Date First Released]&& 'Calendar'[Date] < [Date Last Actual Ship])),"count exception days",COUNTROWS(FILTER(ALL('Calendar WORK_TIME_EXCEPTION_C'),FACT_CUSTOMER_ORDER_LINE_C[SITE] = 'Calendar WORK_TIME_EXCEPTION_C'[SITE]&& [EXCEPTION_DATE] >= [Date First Released]&& [EXCEPTION_DATE] <= [Date Last Actual Ship])))returnCONCATENATEX(list_with_days ,FACT_CUSTOMER_ORDER_LINE_C[Date First Released] & " to " & FACT_CUSTOMER_ORDER_LINE_C[Date Last Actual Ship] & " give " & [duration work days] - [count exception days] , ", " , FACT_CUSTOMER_ORDER_LINE_C[Date First Released] ,ASC)This new basic approch is much more accurate,I do not know how to reports these bug on NETWORKDAYS to developer team ?
1 Reply
- anthony_lecoqRegular Visitor
To bypass this issue of inacuracy of NETWORKDAYS at the total line, I came back to the basic,
I skipped the NETWORKDAYS funktion, and count days in a calculated variable table. and chetck that the aggregation worked properly at the end.
Duration in work days from Release date to Last Ship Date2 =Var selection =CALCULATETABLE(FACT_CUSTOMER_ORDER_LINE_C,FILTER(FACT_CUSTOMER_ORDER_LINE_C ,FACT_CUSTOMER_ORDER_LINE_C[Date First Released] <> BLANK()&& FACT_CUSTOMER_ORDER_LINE_C[Date Last Actual Ship] <> BLANK()))VAR list_with_days =ADDCOLUMNS(selection ,"duration work days",COUNTROWS(FILTER(ALL('Calendar'),WEEKDAY('Calendar'[Date],2) <= 5&& 'Calendar'[Date] >= [Date First Released]&& 'Calendar'[Date] < [Date Last Actual Ship])),"count exception days",COUNTROWS(FILTER(ALL('Calendar WORK_TIME_EXCEPTION_C'),FACT_CUSTOMER_ORDER_LINE_C[SITE] = 'Calendar WORK_TIME_EXCEPTION_C'[SITE]&& [EXCEPTION_DATE] >= [Date First Released]&& [EXCEPTION_DATE] <= [Date Last Actual Ship])))returnCONCATENATEX(list_with_days ,FACT_CUSTOMER_ORDER_LINE_C[Date First Released] & " to " & FACT_CUSTOMER_ORDER_LINE_C[Date Last Actual Ship] & " give " & [duration work days] - [count exception days] , ", " , FACT_CUSTOMER_ORDER_LINE_C[Date First Released] ,ASC)This new basic approch is much more accurate,I do not know how to reports these bug on NETWORKDAYS to developer team ?