Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help required in 'IF Statement' while displaying the Back Ground Color

Hi

I was using the below code in the background of the group to display BG color as red when the day is sunday. It works with the below code.


=if(weekday(date) ='Sun',Rgb(255,0,0))


Now I wanted to display BG color as red when the day is saturday and sunday. I used the below code but it is not working as expected. I know it is simple if statement only but not sure why it is not working.


=if(weekday(date) ='Sat' and weekday(date) ='Sun',Rgb(255,0,0))
=if(weekday(date) ='Sat','Sun',Rgb(255,0,0))


Can some one help me on this please.

1 Solution

Accepted Solutions
Not applicable
Author

Hi

try

=if(weekday(date) ='Sat' or weekday(date) ='Sun',Rgb(255,0,0))

Regards

Anders

View solution in original post

4 Replies
Not applicable
Author

Hi

try

=if(weekday(date) ='Sat' or weekday(date) ='Sun',Rgb(255,0,0))

Regards

Anders

Not applicable
Author

Hi Anders

Thanks for your help! Thats does the trick!

Made very silly mistake again. Very bad of me. 😞

By the way still wondering why the below code didn't work 🙂



=if(weekday(date) ='Sat' and weekday(date) ='Sun',Rgb(255,0,0))


tresesco
MVP
MVP

Hi,

AND means occurance of the two events simulteneouly ('Sat' and 'Sun'), which is not possible in a row, it could be either Sat or Sun. So.. AND doesn't work for your case.

Regards, tresesco

Not applicable
Author


tresesco wrote:
AND means occurance of the two events simulteneouly ('Sat' and 'Sun'), which is not possible in a row, it could be either Sat or Sun. So.. AND doesn't work for your case. <div></div>


Thanks for the explanation!

I totally agree with you! I have done the mistake.

I didn't think of it when I was using AND in the if statement.