Skip to main content
Announcements
MAINTENANCE ALERT: Search experience upgrade - Feb 6: 4 - 8:30AM CET. Downtime expected. READ MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
jerryr125
Creator III
Creator III

Working with variables

Hi - I have a question about variables.

 

I have the following variables set up:

vMaterialC2021

Sum({$<[MaterialCDateYear]={'2021'}>} (MaterialCPrice))

vMaterialC2020

Sum({$<[MaterialCDateYear]={'2020'}>} (MaterialCPrice))

 

Both variables work - no issues.

I am trying to calculate the variance between vMaterialC2021 and VMaterialC2020.

vMaterialVariance

=sum({<[MaterialCDateYear]={'2021'}>} (MaterialCPrice))-sum({<[MaterialCYear]={'2020'}>} (MaterialCPrice))

 

The formula calculates it for the entire population not just for the specific material number.

 

I also tried:

=sum(vMaterialC2021-vMaterialC2020)

no luck

Any thoughts ? Jerry

 

 

 

1 Solution

Accepted Solutions
jerryr125
Creator III
Creator III
Author

Hi I created a master measure -got it -thanks - Jerry

View solution in original post

3 Replies
PrashantSangle

use that specific product in set analysis

like

vMaterialVariance

=sum({<[MaterialCDateYear]={'2021'},product={'Product_name'}>} (MaterialCPrice))-sum({<[MaterialCYear]={'2020'},product={'Product_name'}>} (MaterialCPrice))

 

Regards,

Prashant Sangle

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
jerryr125
Creator III
Creator III
Author

Hi - thank you for the response.

I am using the variable in a table visualization so therefore setting the product_name will not work.

Each product has its own calculation.

 

Thoughts ? Jerry

jerryr125
Creator III
Creator III
Author

Hi I created a master measure -got it -thanks - Jerry