Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
jleefjcapital
Creator II
Creator II

embedding a measure (constructed variable) in another measure

Is it possible to reference a measure to construct another measure? 

I created a measure to calculate the % change over time.   Then, I would like to reference this new variable to create another measure needed for the range slider - 

i.e.,

% change measure -  

num(sum(RETAILTRADE_MSA)/below(sum(RETAILTRADE_MSA)) -1,'#.0%')

new measure for range slider -  this is required for the range slider extension that I am using.   It references the min/max values of the variable.   However, I would like to reference the % change measure.  

Sum({$<RETAILTRADE_MSA ={">=$(=vMin_RETAILJOB) <=$(=vMax_RETAILJOB)"}>} RETAILTRADE_MSA)

It is not working well, but not sure if it's the extension that is not working or if it's not working because it is not possible to reference another created measure. 

Thank you,

Jessica

31 Replies
jleefjcapital
Creator II
Creator II
Author

But the error message is telling me that it can't find

  TOTPRIV_MSA_Delta

jleefjcapital
Creator II
Creator II
Author

I think it's because this variable is created within the same load statement that it's being used in. 

jleefjcapital
Creator II
Creator II
Author

How about this?

EARNINGS_MSA_DELTA:

LOAD *,

          [TOTPRIV_MSA] - Alt(Peek('TOTPRIV_MSA'), [TOTPRIV_MSA]) as TOTPRIV_MSA_Delta;

LOAD *,

         num([TOTPRIV_MSA] - Alt(Peek('TOTPRIV_MSA'), [TOTPRIV_MSA]))/[TOTPRIV_MSA] as [TOTPRIV_MSA_%]

Resident EARNINGS_MSA

Order by DATE;

DROP Table EARNINGS_MSA;

sunny_talwar

The above should be fine, but then why not this:

EARNINGS_MSA_DELTA:

LOAD *,

         ([TOTPRIV_MSA] - Alt(Peek('TOTPRIV_MSA'), [TOTPRIV_MSA]))/[TOTPRIV_MSA] as [TOTPRIV_MSA_%],

         [TOTPRIV_MSA] - Alt(Peek('TOTPRIV_MSA'), [TOTPRIV_MSA]) as TOTPRIV_MSA_Delta

Resident EARNINGS_MSA

Order by DATE;

DROP Table EARNINGS_MSA;

sunny_talwar

Still not working? Can you share your application if its not confidential?

jleefjcapital
Creator II
Creator II
Author

Hi Sunny,

It worked, but the result is not the one I'm looking for.   I can provide the file.  Just give me one minute.  Thank you!

sunny_talwar

No problem, take your time

jleefjcapital
Creator II
Creator II
Author

How do I attach the file?   I can't find that advanced reply link. 

sunny_talwar

I am going to follow you so that you can we can talk on messages and I am more than happy to give you my email id so that you can shoot me an email with your file.

jleefjcapital
Creator II
Creator II
Author

Great!  Thank you.