Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
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)
May be just this
Sum({<Product = {"=Sum({1<Year = {$(=Max(Year))}>} Sales) > 0 and Sum({1<Year = {$(=Max(Year) - 1)}>} Sales) > 0"}>} Sales)
Hi Nani,
Try:
Sum({$<ProdID = p({<Year = {$(=max(Year))}>})>*<ProdID = p({<Year = {$(=-1+max(Year))}>})>}Sales)
Where ProdID identifies products.
good luck
Andrew
Thanks all for the responses. I am trying everyone's solutions. will update everyone once i got the right solution.
Thanks again.
Regards,
Nani
@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
When you say this year? do you mean the selected year and last from the selected year?
No i don't have any year filter.This year means current year irrespective of any selection.
May be this
Sum({<Product = {"=Sum({1<Year = {$(=Year(Today()))}>} Sales) > 0 and Sum({1<Year = {$(=Year(Today()) - 1)}>} Sales) > 0"}>} Sales)
Still same results getting few products which doesn't have sales.