Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

need to create variable?

Hi All,

I need create variables where i can get the last month and subtract it from the first month where product is "ABC".

So i created one variable like

lastmonth= count({<Month={$(=Max(Month)}>}Patient) and PRODUCT="ABC"

firstmonth=count({<Month={$(=Min(Month)}>}Patient) and PRODUCT="ABC"

final variable=

=num(($(lastmonth)-$(firstmonth))/$(lastmonth),'##0.0%')

please let me know if this is correct as I am getting error?

thanks a lot!

Anuradha

3 Replies
jyothish8807
Master II
Master II

Hi,

Try like this:

lastmonth= count({<Month={'$(=Max({1}Month))'},PRODUCT={'ABC'}>}Patient)

firstmonth=count({<Month={'$(=min({1}Month))'},PRODUCT={'ABC'}>}Patient)

Br,

KC

Best Regards,
KC
Anonymous
Not applicable
Author

Hi KC,

I tried it but it showing error in expression ')' expected.

Regards,

Anuradha

jyothish8807
Master II
Master II

Can you try this: or share your expression if it dosent work

(

count({<Month={'$(=Max({1}Month))'},PRODUCT={'ABC'}>}Patient)

-

count({<Month={'$(=min({1}Month))'},PRODUCT={'ABC'}>}Patient)

) /

(

count({<Month={'$(=Max({1}Month))'},PRODUCT={'ABC'}>}Patient)

)

Best Regards,
KC