# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Contributor

## two KPIs with same filter

I have two KPIs, KPI1 is using year1, KPI2 is using year2. I'm trying to create a filter called year, which for KPI1 is year1, for KPI2 is year2. Is that possible?

Thanks for help.

1 Solution

Accepted Solutions
Contributor III

## Re: two KPIs with same filter

I like to use the P() function.  In the example below,

KPI1 is calculated by =Sum({\$<Year1=P(Year)>}Val)

and

KPI2 is calculated by Sum({\$<Year2=P(Year)>}Amt)

this is the data I used:

Data:

Year

2018

2017

2016

];

Data1:

D1,Year1,Val

A,2018,100

B,2017,200

];

Data2:

D2,Year2,Amt

C,2017,300

D,2016,400

];

2 Replies
Contributor III

## Re: two KPIs with same filter

I like to use the P() function.  In the example below,

KPI1 is calculated by =Sum({\$<Year1=P(Year)>}Val)

and

KPI2 is calculated by Sum({\$<Year2=P(Year)>}Amt)

this is the data I used:

Data:

Year

2018

2017

2016

];

Data1:

D1,Year1,Val

A,2018,100

B,2017,200

];

Data2:

D2,Year2,Amt

C,2017,300

D,2016,400

];

Contributor II

## Re: two KPIs with same filter

Hi,

Try with alternate states.

Please find the attached sample app here replace Date with Year.