Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using same formula twice

Hi,

I'm new to QlikView. I managed to write down a simple formula  COUNT({($<WHATEVER={WHATEVER}>)} WHATEVER) as table formula.

However, I would like to use this formula in a table and in a diagram.

But I only want to write down the formula once.

Reason: If I need to change this formula later, I only want to change it once.

What I really want to have: I would like to have a table where all numbers are shown.These numbers are calculated with formulas.

Additionally I want to have some diagrams where certain numbers are visualized.

I don't want to have duplicated formulas.

How can I do that? Is there any way to link the diagram to the table values?

Thank you!

1 Solution

Accepted Solutions
Not applicable
Author

Hi

Copy your formula into a variable and simply use the variable in your objects.  Thus you will only have to maintain your formula in one place.

If you need to share these formula across qvws I would recommend you maintaining these formula in a qvs that can be loaded into each model.

I hope that helps, let me know how you get on.


Regards


Steve

View solution in original post

4 Replies
Not applicable
Author

Hi,

You have asked 2 questions here.

To answer your first question:

You can create a variable and assign your formula/expression to it.

Then you can reuse the variable as many times as you want. IF in future you need to change it, you will have to change it only in one place and it will be reflected everywhere.

To answer your second question:

If you are using the same formula in your diagrams, they will be automatically linked to the table/chart you have already created.

Hope this helps!

Not applicable
Author

Hi

Copy your formula into a variable and simply use the variable in your objects.  Thus you will only have to maintain your formula in one place.

If you need to share these formula across qvws I would recommend you maintaining these formula in a qvs that can be loaded into each model.

I hope that helps, let me know how you get on.


Regards


Steve

dmohanty
Partner - Specialist
Partner - Specialist

Store the formula as a variable in an excel sheet and use the variable in your App, multiple times. Wheneever there is a requirement to change the formula, you have to change once in the excel sheet and reload the app.

Not applicable
Author

Hi Steve,

thank you, that helps.

But there's still an issue: The variable is global.

In my diagrams and table the values were dependent on the dimension before.

Now every dimension (in this case "category") has the global value.

But it should have the value given the category.

Category    Value

Category A    4

Category B    4

Category C    4

Category D    4

How can I now implement this dependency? My formula in my table/diagram is just [VARIABLE1]