Forum Discussion
Time difference between Today and first timestamp
- Anonymous4 years ago
Hi learner03 ,
Please try:
Count = var _first=CALCULATE(MIN('Receipt_lines'[timestamp]),ALLEXCEPT(Receipt_lines,Receipt_lines[Recepit ID])) return CALCULATE(COUNTROWS('Calendar'),FILTER('Calendar', [Date]>=_first && [Date]<=NOW()&& [Flag]=1 ))Measure = CALCULATE([Count], FILTER('Receipt_lines',[Recepit ID]=MAX('Receipt Jobs'[Receipt ID])))Output:
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
littlemojopuppy
Actually , I want to highlight those receipt ID where the job started more than 3 days ago. So, I have reached to the stage where I can highlight those lines that started 3 days ago but I am not able to workout regarding how can I deduct weekends and holidays based on my calender.
I have calender table where it shows 1 for weekday and 0 for weekend.
The column that I have created for more than 3 days is-
learner03 @I'm curious why you're creating a calculated column for this. You always want to use measures. Always.
You have a field for IsWeekday in your date table. Add another field for IsHoliday. And if your calendar is the same as an American holiday calendar, it's kind of a pain because certain dates are holidays (Christmas, December 25; Fourth of July, July 4) and others that are relative (Thanksgiving, fourth Thursday in November).
You should filter dates for (weekend is false) && (holiday is false) and for within the three day period. I'm typing this on an iPad so kind of limited but I would think something like TODAY()-3 would work.
With those dates filtered,, you should be able to use a CALCULCATE function for MIN(ReceiptLines) with the filtered dates as a parameter.
Hope this helps!