Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

homersimpson
Contributor II

One field selection should get two different values

Hi,

  1. i have a calender script and the field "Year".
  2. I have 2 linecharts. First "Sales", second "Price".
  3. The table for "Sales" has one column "salesYear".
  4. The table for "Price" has one column "priceYear".
  5. I want to put only 1 field into my worksheet to select a year.


How can i make it, that if i select a "Year", that the first linechart "Sales" get the year "salesYear" and the second linechart "Price" get "priceYear"?


regards,

Fritz



1 Solution

Accepted Solutions
sfatoux72
Valued Contributor

Re: One field selection should get two different values

It works in Qlik Sense too:

I add the field year in the expression of the calculated dimension YEAR :  = If(Year = salesYear and Year = priceYear and Year = Year,  Year)

When I select 2015 in the calculated dimension, The three other take automaticly the same value:

2016-02-07 16_51_51-Qlik Sense Desktop.png

But I agree with other, that it would be better to use only one field Year in your model. If it's not possible you have this solution

12 Replies
MVP
MVP

Re: One field selection should get two different values

You can add triggers on Year field to select the same year in the other two fields. the action would be Select in Field

Re: One field selection should get two different values

This will help..

Canonical Date

homersimpson
Contributor II

Re: One field selection should get two different values

Hi Sunny,

do you have a link to a help site about triggers? I don´t know what triggers are and can´t find anything.

regards,

fritz

brunobertels
Valued Contributor

Re: One field selection should get two different values

Hi

you should link your calendar year with fiels year from table sales and table price :

somethink like that asuming you have year field named "Year" in your calendar :

sales:

load

"sales Year" as Year,

.....

from ...

prices:

load

"prices year" as year,

then just add filter pan with field year and Year as dimension in your chart

hope it helps

Bruno

MVP
MVP

Re: One field selection should get two different values

‌my bad.... I didn't notice this was Qlik Sense. You will have to go with the other solutions provided as I don't think there are triggers in Qlik Sense as of now.

ogster1974
Honored Contributor II

Re: One field selection should get two different values

You could also concatenate your Sales and Prices into a single fact table during load with the column Year used for both.  Use Set Analysis to identify the Prices Vs Sales in your measure.

homersimpson
Contributor II

Re: One field selection should get two different values

Hi Andy,

do you have an example for it?

regards,

Fritz

homersimpson
Contributor II

Re: One field selection should get two different values

If i use this expression in the select field

='(' & priceYear & '|' & salesYear & ')'


It displays:


2016

2015 | 2014

2014 | 2016

etc.


And both years will and each linechart takes the correct year.


But how can i show only:


2014

2015

2016


in the select field?


regards,

Fritz

sfatoux72
Valued Contributor

Re: One field selection should get two different values

Try with this expression :    = If(salesYear = priceYear,  priceYear)

You will show this

2014

2015

2016

And when you will select one value of this calculated field, the corresponding value in salesYear and priceYear will be selected

2016-02-07 10_22_50-QVCxxx.png

Community Browser