Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

If expression not color coding

I have 4 Variables:

vPrevious4Month

Provides the Month -4 to the current month(07 - 2016)

=Date(addmonths(today(),-4), 'MM-YYYY')

vPrevious3Month

Provides the Month -3 to the current month(08 - 2016)

=Date(addmonths(today(),-3), 'MM-YYYY')

vPrev4MonthCount

Provides the count of [Incident Identifier] for 4 months prior to current month

=count(DISTINCT {$<[Ticket Created Month]={"$(vPrevious4Month)"}>}[Incident Identifier])

vPrev3MonthCount

Provides the count of [Incident Identifier] for 3 months prior to current month

=count(DISTINCT {$<[Ticket Created Month]={"$(vPrevious4Month)"}>}[Incident Identifier])

I am trying to BACKGROUND COLOR based on if vPrev4MonthCount is greater or equal to vPrev3MonthCount.  The below expression works when a specific "Application Name" is selected, but does

not work if nothing is selected.  I need it to BACKGROUND COLOR without an "Application Name" being selected

=if(($(vPrev4MonthCount)>=$(vPrev3MonthCount)),Green(),Red())

Working when Application Name selected:

Picture1.png

Not working when Application Name not selected:

Picture2.png

Any suggestions on what I should try?

3 Replies
sunny_talwar

Do you have an equal sign when you declare your variable in the variable overview? Try to remove it.

Alternatively, you can also try the use of variable without the dollar sign expansion

=If(vPrev4MonthCount >= vPrev3MonthCount, Green(), Red())

Anonymous
Not applicable
Author

Sunny T -

When I removed the = sign in the vPrev4MonthCount & vPrev3MonthCount Variables Overview, I get the "Error in set modifier ad hoc elements list:',' or ')' expected.

Removing the $ from the expressions does not correct the BACKGROUND COLOR issue

Dan

sunny_talwar

Would you be able to provide a sample to look at the issue?