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

Announcements
Posting on Qlik Community is temporarily paused. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
vinodmehar22
Contributor
Contributor

Need help in set analysis qlik sense

Hi,

 

I have to sum the total where year =2022, productid -=19*, and trackingid-=98* can you please help write the set analysis?

if the productid starts with 19* then only I have to remove the  trackingid which starts wiht 98* otherwise it has to include them.

Thanks and Regards,

Vinod.

 

Labels (1)
6 Replies
Qrishna
Master
Master

= Sum({$<year = {'2022'}, productid -= {"19*"}, trackingid-= {"98*"}> } Sum_field)

vinodmehar22
Contributor
Contributor
Author

Hi,

 

I have other trackingid starts with 98* which are comming form different productid's i have to include them.

Qrishna
Master
Master

JUST KEEP INCLUDING THEM IN THE EXPRESSION:

= Sum({$<year = {'2021', '2022'}, productid -= {"19*", "20*"}, trackingid-= {"97*", "98*"}> } Sum_field).

 

please provide some sample data and a picture of the desired output for more accurate solution.

Kushal_Chawda
MVP
MVP

@vinodmehar22  try below. Not sure which aggregation you would like to perform but below will be the set expression

Count({<productid={"19*"},trackingid-={"98*"}> + <productid-={"19*"}>}ID)

or

sum({<productid={"19*"},trackingid-={"98*"}> + <productid-={"19*"}>}Value)

_Iswarya_
Contributor III
Contributor III

@vinodmehar22  Missed the Year=2022,

sum({<PID={"19*"},tracking_id-={"98*"}> + <product_id-={"19*"},YEAR={'2022'}>}SALES)

 
Kushal_Chawda
MVP
MVP

@_Iswarya_  I assumed that we can select the year to get the results . But if it is just for year 2022 always then , more dynamic solution would be below assuming it is previous year

sum({<productid={"19*"},trackingid-={"98*"}, Year ={"$(=max(Year)-1)"}> + <productid-={"19*"},Year ={"$(=max(Year)-1)"}>}Value)