Forum Discussion
Anonymous
5 years agoNot applicable
weird days between issue
Hello Community - Confused as to why my formula is returning the following results. The formula is calculating the days elapsed between the Order Date and the FCHR date. I wanted to ensure...
- 5 years ago
hi Anonymous
To my understand, you could use this formula to get it:
Order vs FCHR Weekday Count = IF('Flu Shipped'[FCHR Date]=BLANK(),0, IF( 'Flu Shipped'[Order Date] <= 'Flu Shipped'[FCHR Date], COUNTROWS( FILTER(DateTable,DateTable[Date]>='Flu Shipped'[Order Date]&&DateTable[Date]<'Flu Shipped'[FCHR Date]&&DateTable[DateIsWorkingDay]=TRUE())), COUNTROWS( FILTER(DateTable,DateTable[Date]>='Flu Shipped'[Order Date]&&DateTable[Date]<'Flu Shipped'[FCHR Date]&&DateTable[DateIsWorkingDay]=TRUE())) * -1)+0)or
adjust your formula as below:
Order vs FCHR Weekday Count 2 = var days=IF(CALCULATE( COUNTROWS( DateTable ), DATESBETWEEN ( DateTable[Date], 'Flu Shipped'[Order Date], 'Flu Shipped'[FCHR Date]),DateTable[DateIsWorkingDay]= True, ALL ( 'Flu Shipped' ) )=BLANK(),1,CALCULATE( COUNTROWS( DateTable ), DATESBETWEEN ( DateTable[Date], 'Flu Shipped'[Order Date], 'Flu Shipped'[FCHR Date]),DateTable[DateIsWorkingDay]= True, ALL ( 'Flu Shipped' ) )) return IF('Flu Shipped'[FCHR Date]=BLANK(),0, IF( 'Flu Shipped'[Order Date] <= 'Flu Shipped'[FCHR Date], days-1, days * -1)+0)Regards,
Lin
amitchandak
5 years agoSuper User
Anonymous , Not very clear,
Can you create a diff column
Date diff = datediff([Order Date] , [FCHR date],day)
Anonymous
5 years agoNot applicable
amitchandak Yes, this works, but needs to take into account only week days. Is there a way to incorporate your formula into mine to ensure that only week days are counted?
- v-lili6-msft5 years agoCommunity Support
hi Anonymous
To my understand, you could use this formula to get it:
Order vs FCHR Weekday Count = IF('Flu Shipped'[FCHR Date]=BLANK(),0, IF( 'Flu Shipped'[Order Date] <= 'Flu Shipped'[FCHR Date], COUNTROWS( FILTER(DateTable,DateTable[Date]>='Flu Shipped'[Order Date]&&DateTable[Date]<'Flu Shipped'[FCHR Date]&&DateTable[DateIsWorkingDay]=TRUE())), COUNTROWS( FILTER(DateTable,DateTable[Date]>='Flu Shipped'[Order Date]&&DateTable[Date]<'Flu Shipped'[FCHR Date]&&DateTable[DateIsWorkingDay]=TRUE())) * -1)+0)or
adjust your formula as below:
Order vs FCHR Weekday Count 2 = var days=IF(CALCULATE( COUNTROWS( DateTable ), DATESBETWEEN ( DateTable[Date], 'Flu Shipped'[Order Date], 'Flu Shipped'[FCHR Date]),DateTable[DateIsWorkingDay]= True, ALL ( 'Flu Shipped' ) )=BLANK(),1,CALCULATE( COUNTROWS( DateTable ), DATESBETWEEN ( DateTable[Date], 'Flu Shipped'[Order Date], 'Flu Shipped'[FCHR Date]),DateTable[DateIsWorkingDay]= True, ALL ( 'Flu Shipped' ) )) return IF('Flu Shipped'[FCHR Date]=BLANK(),0, IF( 'Flu Shipped'[Order Date] <= 'Flu Shipped'[FCHR Date], days-1, days * -1)+0)Regards,
Lin