Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

brunobertels
Valued Contributor

Variable in set analysis ( very simple in theory ...)

Hi Qlik Sensers

hre is my problem

i have a bar chart that give number of sending calls per quarter of hour like this :

if a select a particular week ( let say week 7) it's cumulating sending calls per quarter for all the days of the week.

I did first 5 charts for each weekday and then i thought i could manage this with a VARIABLE to select wich day i want to show data per quarter.

I thougt it would be easy ....

I use qsvariable and set variable name vJourSemaine

select render as "button" like that :

then add : add alternative and enter this :

value 0 label Lundi ( monday)

value 1 label Mardi ( Thuesday) etc still friday

Then in my expression I add this :

Count({$<[In/out]={'sortant'},JourSemaine={'$(vJourSemaine)'}>}Teleop)

count number of Teleop where field In/Out is "sortant" and dimension "JourSemaine" (weekday) is equal to my variable

But it does'nt work

What I am doing wrong ?

thanks for help

Bruno

1 Solution

Accepted Solutions
reddys310
Honored Contributor II

Re: Variable in set analysis ( very simple in theory ...)

Hi Bruno,

Is the $(vJourSemaine) returning the values as 'lun.' ? I would suggest you to test it with a text object just to make sure that the right value is being returned.

Thanks,

Sangram.

7 Replies
cesaraccardi
Valued Contributor

Re: Variable in set analysis ( very simple in theory ...)

Hi Bruno,

If you replace the variable evaluation by one of the values, 0 for example, does it work?

Count({$<[In/out]={'sortant'},JourSemaine={'0'}>}Teleop)

brunobertels
Valued Contributor

Re: Variable in set analysis ( very simple in theory ...)

Hi Cesar

No it does'nt work

It's works with that

Count({$<[In/out]={'sortant'},JourSemaine={'lun.'}>}Teleop)


my dimension Joursemaine is made with this in my script

weekday(date) as JourSemaine // so it's giving lun. mar. mer. jeu. ven. as results


I tried to change my variable by setting

value:

lun.

Label : Lundi

or value 'lun.' but it's not working ...


Bruno


cesaraccardi
Valued Contributor

Re: Variable in set analysis ( very simple in theory ...)

Hi Bruno,

So in that case you have to change the values like you did, you might have to recreate the object to update the variable value or use the variable overview and change it manually.

Cesar

Re: Variable in set analysis ( very simple in theory ...)

Have you checked the variable-value within a textbox if it returned what you expected. Further helpful might be this: Variables.

Btw. if you would use a listbox on the weekday it would be a lot easier.

- Marcus

reddys310
Honored Contributor II

Re: Variable in set analysis ( very simple in theory ...)

Hi Bruno,

Is the $(vJourSemaine) returning the values as 'lun.' ? I would suggest you to test it with a text object just to make sure that the right value is being returned.

Thanks,

Sangram.

brunobertels
Valued Contributor

Re: Variable in set analysis ( very simple in theory ...)

Hi all

Thanks for the help

At the end it's working perfectly

adding alternative to my variable like this

value = lun. label Lundi etc till wednesday to have the 5 days of a week lun. mar. mer. jeu. ven. without quote and it's giving me the result needed

Thanks again

reddys310
Honored Contributor II

Re: Variable in set analysis ( very simple in theory ...)

Glad it helped!