Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
stalwar1 Kindly help on this one..
luismadriz Kindly help on this one....please.
shraddha.g Kindly help...
Not entirely sure, but may be this
If(GetSelectedCount(reportdate) = 0, Black(), If(GetSelectedCount(reportdate) = 1, If(Count({$}Empid) > If(Count(TOTAL {$1}Empid) = 0, Count({<Date = {"$(=$(max_date))"}>} Empid), Count({$1}Empid)), Red(), Green())))
on first selection it is showing all in green color but not comparing with the default max date
but for second selection onwards its working fine
My bad, try this
If(GetSelectedCount(reportdate) = 0, Black(), If(GetSelectedCount(reportdate) = 1, If(Count({$}Empid) > If(Count(TOTAL {$1}Empid) = 0, Count({<reportdate = {"$(=$(max_date))"}>} Empid), Count({$1}Empid)), Red(), Green())))
its again comparing with total value but not with the default max value....thats why showing in all green colors..
We want is that when we select any value from report date filter for first time then as previous selected value was by default max date, then the current selected value should be compared with the previous date selected value(default max date)
Though after first selection the cycle is working fine..
I see the problem... the problem is not the expression, its the way Qlik Sense's selection works... To make a change in selection, you have to make two selections. First you deselect what is already selected and then you select what you want to (or the other way around). For some reasons, they are considered two selections. May be you want to go back two selections with $2 instead of $1
This
If(GetSelectedCount(reportdate) = 0, Black(), If(GetSelectedCount(reportdate) = 1, If(Count({$}Empid) > If(Count(TOTAL {$2}Empid) = 0, Count({<reportdate = {"$(=$(max_date))"}>} Empid), Count({$2}Empid)), Red(), Green())))