Forum Discussion
Show next days data
Hi,
The solution I am looking for seems to be pretty straight forward, however, I must be missing something.
I want to create a calculated column that will print a certain string ("next day" for instance) only for the next day and for every other day, blank fields. However, the trick is to essentially skip weekends as there is no data available there in my dataset. So if the current day is Friday, Saturday or Sunday, display data for Monday.
Thanks
- Anonymous2 years ago
Hi Klaud ,
Update the column.
NextDayColumn = VAR CurrentDate = TODAY() VAR CurrentWeekday = WEEKDAY(CurrentDate, 2) VAR NextDate =IF( CurrentWeekday<=4,TODAY()+1,[Date]+(7-CurrentWeekday)+1) RETURN IF([Date]=NextDate,"next day",BLANK())Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
6 Replies
- AnonymousNot applicable
Hi Klaud ,
According to your description, here are my steps you can follow as a solution.
(1) This is my test data.
Date = CALENDAR(DATE(2023,1,1),DATE(2023,12,31))(2) We can create a calculated column.
NextDayColumn = VAR CurrentDate = 'Date'[Date] VAR NextDate = 'Date'[Date] + 1 VAR NextWeekday = WEEKDAY(NextDate, 2) RETURN IF ( NextWeekday <= 5, "next day", BLANK() )(3) Then the result is as follows.
...
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- KlaudFrequent Visitor
Hi Anonymous
This is nearly there. However, I would only like the string to be printed for the next day, like this:I do apologise, my explanation might have been a bit unclear. Hopefully that clears things out as to what I am trying to achieve.
Thanks for all the effort.
- AnonymousNot applicable
Hi Klaud ,
Update the column.
NextDayColumn = VAR CurrentDate = TODAY() VAR CurrentWeekday = WEEKDAY(CurrentDate, 2) VAR NextDate =IF( CurrentWeekday<=4,TODAY()+1,[Date]+(7-CurrentWeekday)+1) RETURN IF([Date]=NextDate,"next day",BLANK())Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- KlaudFrequent Visitor
PijushRoy Not quite the answer I was looking for. What I meant was anything that I could use as a filter on a visual that will display next days data like this - IF('Calendar'[Date] = TODAY() + 1, "Next Day", BLANK()).
In addition to that, I would like the formula to point to Monday if the current day in my calendar table is Friday, Saturday or Sunday.