Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
nehapathak
Contributor II
Contributor II

Change in text color expression in Qliksense

Hi All,

I have attached a QVF file.

I Have a table with customers and count of employee id corresponding to those customers.

I have created a variable named max_date which basically calculate the maximum date from date field.


when the app is opened for the very first time then the data is displayed w.r.t. the max date i.e. Dec i.e nothing is selected from the date filter.

My requirement is that when the app is opened and data is displayed corresponding to max date i.e. December then my text color should be black.

when I select any date from date filter then my text color should changed as follows:

If current count of emplid > previous selected date count of emplid then Red.

If current count of emplid > previous selected date count of emplid then green.

Problem I m facing while using the expression I have created i.e.

if(GetSelectedCount(reportdate)=0,black(),

if(GetSelectedCount(reportdate)=1, if(count({$}Empid) > Count({$1}Empid),red(),Green() ))

)

is on first selection of date from date filter the current count of emplid is compared with the total count of all the dates and give color accordingly which is wrong.

For eg. if for first time I select October then count corresponding to October is being compared with the count of Dec, Nov, Oct.

What is want is that when on first selection I select October then the October count should be compared with max date i.e. max_date variable data and on next selection the current filter selection count  should be compared with the previous selected filter date and should give colors accordingly.

Kindly Help.

Thanks In advance.

17 Replies
pooja821
Creator
Creator

Sorry to say but its still not working..

sunny_talwar

Have you checked the attached sample... I saw it working for me...

sunny_talwar

Since the colors are barely noticeable, I have created a separate expression to show what color it should be showing...

When we open up

Capture.PNG

Next we select 10/31/2017

Capture.PNG

Next we select 11/30/2017

Capture.PNG

Also, added as a background color for better visibility

pooja821
Creator
Creator

Yes, I have checked.

Its still comparing with total value.

The thing is that on the first selection all the numbers are reducing which are less in comparison to the total value that's why the color has changed to green.

Unfortunately there is no case where the number has increased upon first selection, else you would have come to know about the problem.

pooja821
Creator
Creator

And also we are using Field UI extension with by default one selection at a time instead of filter pane.

nehapathak
Contributor II
Contributor II
Author

hi Sunny

Your app is working fine with normal filter pane but not with field UI extension (used for always one selected value)

When I am selecting specific customers from pivot table the colors are not changing correctly

but without any selection of customer its working fine.

sunny_talwar

I don't have the extension, so I don't really know how it works. May be someone with the extension can help better

sunny_talwar

I think the problem is not with the expressions that I have been offering, the issue has to do with the extension.... If you will continue to attack the wrong problem, you will get no where. I think what you need to do is to check how does $1, $2 behave with your selection in the extension filter object. Once you are able to figure that part out, the expression's logic itself will stay the same....

Does that make sense?