# Qlik Sense Deployment & Management

Announcements
Qlik Highlights 2020 Giveaway! Watch, reply and have a chance to win a \$200 Amazon Gift Card! Watch Video
cancel
Showing results for
Did you mean:
Partner

## Use a defined KPI in another KPI measure in master items?

Hi Folks,

I have defined two measures in master items. KPI A and KPI B.

KPI A is defined as following:

A =

long-term liabilities

+

short-term liabilities.

KPI B is defined as following:

B =

stocks

+

requirements.

I want to create KPI C:

C =

A

-

B.

The situation is, Qlik Sense gives an error message, when I edit formula C and put in A - B.

The only way so far is confusing and following:

C =

long-term liabilities

+

short-term liabilities

-

stocks

-

requirements.

I heard about the possibility of storing formulas in variables and using them in other formulas (in this case "C"). I'm at a loss, because the previous method is very confusing to create KPIs that use other KPIs.

Can someone give me a key word, which allows me to google?

Thanks a lot

Tim

1 Solution

Accepted Solutions
Specialist II

Hi Tim

You can creat variable to store your mesure then call them as another mesure

Exemple

lets say A =

sum([long-term liabilities])

+

sum([short-term liabilities])

create a variable ( clic at the bottom left button )

Do the same for mesure B

Now you can either create a KPI for C

=\$(A) + \$(B)

dollar sign and parenthese are used to call variable

Or create a third variable

Same approch open the variable editor

name your variable as C for example and add as mesure this

=\$(A) + \$(B)

Then in a KPI just add \$(C) as mesure

Hope it helps

4 Replies
Specialist II

Hi Tim

You can creat variable to store your mesure then call them as another mesure

Exemple

lets say A =

sum([long-term liabilities])

+

sum([short-term liabilities])

create a variable ( clic at the bottom left button )

Do the same for mesure B

Now you can either create a KPI for C

=\$(A) + \$(B)

dollar sign and parenthese are used to call variable

Or create a third variable

Same approch open the variable editor

name your variable as C for example and add as mesure this

=\$(A) + \$(B)

Then in a KPI just add \$(C) as mesure

Hope it helps

Partner

Hi Bruno,

thanks a lot for your responce. I tried that way.

I'm just wondering about the testimony of a colleague who said that the word code injection is what I should look for. Google said "Code Injection + Qlik zero hits"

Specialist II

Hi Tim

Not sure to understand what your collegue means by "word code injection"

in script editor you can type the first lettre of a dimension and Qlik propose a list of possible occurrence

The same is possible with variable , if you type the first letter of a variable name Qlik will give a list of possible variable name.

But for master mesure and dimension this is not possible.

Regards

Bruno

Partner

Hi Bruno,

Hm that sounds complicated. The first variant you have explained works.

Thank you.

Regards

Tim