Forum Discussion
Using DateDiff to find days between two dates in the same column using another column as a filter.
- 6 years ago
Hi,
Thanks for the response.
I essentially found a solution using the same concept however I did it in a much simpler way using the GUI built into Power BI. I duplicated the table and filtered the original by the code I wanted. Then I filtered the duplicated table to the secondary code I needed. After that I created a relationship between the two tables and was able to pull the dates into my DATEDIFF formula to produce the number of days between. Everything seems to be working great!
Thanks again.
Hi tsuggs1 ,
We can use the following measure to meet your requirement:
Workday Count =
COUNTROWS (
FILTER (
CALENDAR (
'Table1'[actualTime - Customs Cleared].[Date],
RELATED ( 'Table1(2)'[actualTime -Delivered].[Date] )
),
NOT ( WEEKDAY ( [Date] ) IN { 1, 7 } )
)
)
Best regards,
It is not allowing me to use:
Table1'[actualTime - Customs Cleared].[Date]
&
'Table1(2)'[actualTime -Delivered].[Date]
as a measure.
When I try creating it as a column I am getting an error that 'the start or end date in Calendar function can not be a Blank value'.
Note there are some columns where one of these dates may be null. I would also like to keep the days negative or postive based on if the end date is before the start date in some instances, as these 'days between' are then determining whether these items are "on time" based on another measure.
Let me know if you need anything else from me or if you can provide any other guidance!
- tsuggs16 years agoHelper IHere is the solution I ended up using:
https://community.powerbi.com/t5/Desktop/Trying-to-find-a-way-to-exclude-weekends-using-DateDiff-with/m-p/895377/highlight/true#M429235