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: 
FabioManniti
Contributor III
Contributor III

Build a measure or dimension based on filter

Hello I'm new with QLik so sorry if the question is dumb.

I am making a report where I have several graphs with some quantity which depends on a filter selection.

I have a filter called "Machines" and then I have three different prices based on the machine name.

What I do is put a measure like this:

If(Machines='Ab042', SUM(price_ab),

if(Machines='Xr330', SUM(price_xr),

if(Machines='JJ8',SUM(price_jj))))

and anytime I have to make the same script.

Before QLik I used to work with Tableau where you can make a custom measure that, for instance, I would call "machine_price" which would be something like

machine_price = 

If(Machines='Ab042', SUM(price_ab),

if(Machines='Xr330', SUM(price_xr),

if(Machines='JJ8',SUM(price_jj))))

so anytime I make a graph I can just put into the Measure field the value of machine_price.

 

I was wondering: is it possible to do something similar with QLik?

Labels (3)
2 Replies
MayilVahanan

Hi

You can store the measure in the variables and re-use it.

Creating a variable ‒ Qlik Sense on Windows

Using variables in expressions ‒ Qlik Sense on Windows

Hope it helps you

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
vinieme12
Champion III
Champion III

create a variable

vPriceField  =pick(wildmatch(Machines,'Ab042','Xr330','JJ8'),'price_ab','price_xr','price_jj')

 

in chart use Measure as below

=sum($(vPriceField ))

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.