Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
danosoft
Specialist
Specialist

Filter Chart with variable

Hi i have those two variables:

Set vAnnoTempo = GetFieldSelections(ANNOTEMPO);

Set vMeseTempo = GetFieldSelections(MESETEMPO);

ANNOTEMPO and MESETEMPO are fields of my TIME_TABLE

i want those variables takes from my fields selection:

When i choose for example Anno: 2017          Mese: 2

I want my chart will be filter from my vAnnoTempo and vMeseTempo, but its not start

The set analisys expression i have in my chart is:

=Sum({<ANNO_IN={"=$(vAnnoTempo)"},MESE_IN={"=$(vMeseTempo)"}>} CONSUMO_TOT_ANNUO)

ANNO_IN and MESE_IN are my fields in my CONTR table.

p.s.: CONTR table and TIME_TABLE are not connected, and this is correct, i not want are connected, i want do my filter with set analisys in this way, becouse for every dimension i have in my chart i need to do a different set analisys

Thanks

49 Replies
olivierrobin
Specialist III
Specialist III

i can't upload the example

try to copy and paste the above code

danosoft
Specialist
Specialist
Author

It not works... if i choose month 12, 3 it show me 150 but it need show me only 100 becouse it have the max date for this punto: PR01

olivierrobin
Specialist III
Specialist III

here is the result I have (100)

danosoft
Specialist
Specialist
Author

sure, you choose only 12....

you need to choose 12 and 3 for "mesetempo"

or if you want choose only one month like 12 use this:

t:

load * inline [

ANNO_IN,MESE_IN,COD_PUNTO,DATA_IN,CONSUMO_TOT_ANNUO

2018,12,PR01,10/10/2018,100

2018,12,PR01,12/10/2018,200

2018,3,PR01,4/10/2018,50

2018,1,PR02,10/10/2018,300

];

and for result in this case you must to have 200 (not 300)

olivierrobin
Specialist III
Specialist III

in fact you need the product with the highest date AND the rows of this highest date ....

=Sum({<

COD_PUNTO=P({<DATA_IN={'$(=date(Max(DATA_IN),'DD/MM/YYYY'))'}>}COD_PUNTO),

DATA_IN={'$(=date(Max(DATA_IN),'DD/MM/YYYY'))'}

,

ANNO_IN={'$(=GetFieldSelections(ANNOTEMPO))'},MESE_IN={'$(=Concat(GetFieldSelections(MESETEMPO, chr(39) & ',' & chr(39))))'}>} CONSUMO_TOT_ANNUO)

danosoft
Specialist
Specialist
Author

With this new expression you write it works!!! thanks.... but... if i choose mesetempo=3 it not show me nothing...

olivierrobin
Specialist III
Specialist III

of course,

DATA_IN={'$(=date(Max(DATA_IN),'DD/MM/YYYY'))'}

retrieves the highest date of all the table

you have to modify it if you want to xconsider only the selections you made

danosoft
Specialist
Specialist
Author

But no sorry... like i say from the first time i need an expression to take me the Max date of every "cod_punto"

danosoft
Specialist
Specialist
Author

ok i understood is impossible to do it in Qlik, really thank you very much for your time Oliver

olivierrobin
Specialist III
Specialist III

well, impossible is not qlik

but for the moment I don't have the good idea to resolve you case

sorry