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

Help needed on set analysis

Hi All,

Hope everyone is doing great.

I need small help in indirect set analysis.

I am calculating current year Sales for products which got sales both lat year and this year.

i have tried this using set analysis as given below.

Sum({<Sales= p({<Sales= {"=Sum({1<Year={$(=Max(Year))}>}Sales)>0"}>})*

p({<Sales= {"=Sum({1<Year={$(=Max(Year)-1)}>}Sales)>0"}>})>}Sales)


but the above expression calculating sales for all the products irrespective of the P() condition.


Can someone throw some light around the issue here.

Thanks in advance,

Regards,

Nani

1 Solution

Accepted Solutions
sunny_talwar

How about trying something like this

If(Sum({<Product = {"=Sum({1<Year = {$(=Year(Today()))}>} Sales) > 0 and Sum({1<Year = {$(=Year(Today()) - 1)}>} Sales) > 0"}>} Sales) = 0, 100000000, Sum({<Product = {"=Sum({1<Year = {$(=Year(Today()))}>} Sales) > 0 and Sum({1<Year = {$(=Year(Today()) - 1)}>} Sales) > 0"}>} Sales))

and then try the inbuilt function... problem is that, in the eyes of Qlik, 0 is part of the bottom 5 products that you are looking for... may be force the 0's to be very large compared to other values

View solution in original post

21 Replies
antoniotiman
Master III
Master III

Hi Nani,

maybe

Sum({<Product= p({<Product= {"=Sum({1<Year={$(=Max(Year))}>}Sales)>0"}>})*

p({<Product= {"=Sum({1<Year={$(=Max(Year)-1)}>}Sales)>0"}>})>}Sales)


sunny_talwar

May be just this

Sum({<Product = {"=Sum({1<Year = {$(=Max(Year))}>} Sales) > 0 and Sum({1<Year = {$(=Max(Year) - 1)}>} Sales) > 0"}>} Sales)

effinty2112
Master
Master

Hi Nani,

Try:

Sum({$<ProdID = p({<Year = {$(=max(Year))}>})>*<ProdID = p({<Year = {$(=-1+max(Year))}>})>}Sales)

Where ProdID identifies products.


good luck

Andrew

Not applicable
Author

Thanks all for the responses. I am trying everyone's solutions. will update everyone once i got the right solution.

Thanks again.

Regards,

Nani

Not applicable
Author

@antoniotiman and @stalwar1 both your answers are giving same result but still i am getting some products in my bar chart which dont' have sales either last year and this year.

i am trying to understand if i miss anything here.

Thanks,

Nani

sunny_talwar

When you say this year? do you mean the selected year and last from the selected year?

Not applicable
Author

No i don't have any year filter.This year means current year irrespective of any selection.

sunny_talwar

May be this

Sum({<Product = {"=Sum({1<Year = {$(=Year(Today()))}>} Sales) > 0 and Sum({1<Year = {$(=Year(Today()) - 1)}>} Sales) > 0"}>} Sales)

Not applicable
Author

Still same results getting few products which doesn't have sales.