Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am looking for an expression that allows me to sort a table based on today's day.
I have a table named Monday, Tuesday, Wednesday, Thursday and Friday. If today is Wednesday the order will have to be Wednesday Thursday Friday Saturday Sunday Monday Tuesday. and if it is Friday the order will have to be Friday Saturday Sunday Monday Tuesday Wednesday Thursday.
How can I write this expression?
Thanks in advance!
Hi
Create a field in backend for shorting and use that field in custom sort .
Load *, Pick(Match(WKDay, Today, T_1, T_2, T_3, T_4, T_5)+1, 7, 1,2,3,4,5,6) as DayShort;
Load *, Left(Day, 3) as WKDay, WeekDay(Today()) as Today, WeekDay(Today()-1) as T_1 , WeekDay(Today()-2) as T_2 , WeekDay(Today()-3) as T_3 , WeekDay(Today()-4) as T_4 , WeekDay(Today()-5) as T_5 Inline
[
Day
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
];
Drop Field Today, T_1, T_2, T_3, T_4, T_5;
Ex: We can use DayShort is the field used to sort the dimension.
Hi
Create a field in backend for shorting and use that field in custom sort .
Load *, Pick(Match(WKDay, Today, T_1, T_2, T_3, T_4, T_5)+1, 7, 1,2,3,4,5,6) as DayShort;
Load *, Left(Day, 3) as WKDay, WeekDay(Today()) as Today, WeekDay(Today()-1) as T_1 , WeekDay(Today()-2) as T_2 , WeekDay(Today()-3) as T_3 , WeekDay(Today()-4) as T_4 , WeekDay(Today()-5) as T_5 Inline
[
Day
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
];
Drop Field Today, T_1, T_2, T_3, T_4, T_5;
Ex: We can use DayShort is the field used to sort the dimension.
You could try something like this.
Dual(
date(datefield, 'WWWW'),
weekday(datefield , weekday(today()))
)