Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Issue with getting result of set analysis

I am trying to return a result using set analysis which should return records only for one but instead it is returing all the results.

Can some one please help with my query please.

thanks

=sum({$<[~Cmmdty_Commodity]={'Steel'},[Cmmdty_Period]={"=max([Cmmdty_Period])"},>}Cmmdty_Price)

It should return result for the month of the june 2015 which is the maximum period we got and the data is passing from data island and i believe the selections will not impact the result of it. while is used only instead of sum i am not getting any data.

Thanks in adva

1 Solution

Accepted Solutions

Re: Issue with getting result of set analysis

Try this

=sum({$<[~Cmmdty_Commodity]={'Steel'},[Cmmdty_Period]={"$(=max([Cmmdty_Period])) "}>}Cmmdty_Price)

11 Replies

Re: Issue with getting result of set analysis

Try this

=sum({$<[~Cmmdty_Commodity]={'Steel'},[Cmmdty_Period]={"$(=max([Cmmdty_Period])) "}>}Cmmdty_Price)

Re: Issue with getting result of set analysis

I addition you may also require to add date formatting to Max([Cmmdty_Period]) in case it is formatted as a date field:

=Sum({$<[~Cmmdty_Commodity]={'Steel'}, [Cmmdty_Period]={"$(=Date(Max([Cmmdty_Period]), 'Cmmdty_PeriodFormatHere'))"}>} Cmmdty_Price)

Not applicable

Re: Issue with getting result of set analysis

thanks for reply sunny.

Did't work well as expected.

Thanks

Kumar

Not applicable

Re: Issue with getting result of set analysis

thanks Settu.

I was trying to calculcate the same way for previous month by using addmonths function on the max

(date) but it is return zero instead of values.

Can you please help me with that.

thanks

Re: Issue with getting result of set analysis

Can you share your expression?

It may be like

=sum({$<[~Cmmdty_Commodity]={'Steel'},[Cmmdty_Period]={"$(=Addmonths (max([Cmmdty_Period]),-1)) "}>}Cmmdty_Price)

Not applicable

Re: Issue with getting result of set analysis

I did try that but it is returing zero instead of the previous month values.

Thanks

Re: Issue with getting result of set analysis

Are you making a selection in Cmmdty_Period field or another field? If you are making selection in another date field, then tell your expression to ignore them:


=Sum({$<[~Cmmdty_Commodity]={'Steel'},[Cmmdty_Period]={"$(=Addmonths (max([Cmmdty_Period]),-1)) "}, Date = , Month, MonthYear, Year, Quarter>}Cmmdty_Price)

Not applicable

Re: Issue with getting result of set analysis

Suuny,

i am not making any selection to infulence the results and the data is coming from a data island.

Re: Issue with getting result of set analysis

Hi Surendra,

Can you provide the sample to Test?

Community Browser