Forum Discussion
Help with error when creating a measure for a date filter
- Anonymous1 year ago
Hi, Belle2015
Based on your information, I create you table. At the same time, I added a piece of data from January 6th to test it.
Then create a new measure:
PreviousDayOrWeekendData = VAR TodayIsMonday = WEEKDAY(MAX('Table'[Count Date]), 2) = 1 VAR _PreviousDay = CALCULATE(SUM('Table'[TotalStockPlusDiff]), 'Table'[Count Date] = MAX('Table'[Count Date]) - 1) VAR WeekendData = CALCULATE(SUM('Table'[TotalStockPlusDiff]), WEEKDAY('Table'[Count Date], 2) IN {6, 7} && 'Table'[Count Date] <= MAX('Table'[Count Date])) RETURN IF(TodayIsMonday, WeekendData, _PreviousDay)Put this measure in table visual and create a slicer. Here is my preview:
When you select a slicer, the metrics also change. At the same time, it calculates the sum of the weekends up to the date selected by the current slicer.
How to Get Your Question Answered Quickly
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi whats is your expected resultt based on data you provided? i'll make some logic here to filter your data, just give me more context.
Thank you
Thanks for helping 🙂
I am trying to look at the counts done the previous day so as we can see what % of stock was used or added in, on a Monday I want to be able to see what was counted for on the Friday, Sat and Sunday.
The table may have multiple counts done on the same product and it can be counted more than once on the same day.
Hope that explains it ok.