Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

trouble with building a setanalysis

Hello,
I'm having some trouble with building a setanalysis in qlikview
I want to compare two dates in sales with the min and max.
This is the syntax i'm using now:
max
sum
( {<date = {$(=max([date])-1) }>} sales)
min
sum
( {<date = {$(=min([date])-1) }>} sales)
But as a result i get € 0,-
What am i doing wrong?
1 Solution

Accepted Solutions
nilesh_gangurde
Partner - Specialist
Partner - Specialist

Hi please find the Attachment.

View solution in original post

15 Replies
masha-ecraft
Partner - Creator
Partner - Creator

You might not have any sales registered on date prior to your maximum date (max(date)-1) and that is why you are getting 0 for the first expression.

The second expression calculates sum of sales for the date prior to minimum date (min(date)-1). Such date should not exist.

nilesh_gangurde
Partner - Specialist
Partner - Specialist

Hi Renes,

If Possible please attach the qvw file with the sample data.

Regards,

Nilesh Gangurde

Miguel_Angel_Baeyens

Hi,

Max() always return a numeric value, while my guess is that the field "date" has a non numeric value ("21/05/2012") so you will need to format it in the set analysis functions, for example:

Sum({< date = {'$(=Date(max([date])-1))'} >} sales)

Anyway, try in a text object that the result of the function is the same as the format in the "date" field. Note as well that in QlikView fields are case sensitive, so "Date" is not the same as "date".

Hope that helps.

Miguel

Not applicable
Author

Hello Nilesh, hereby the qvw.

Thank you for your help.

Not applicable
Author

Hello Nilesh, did you find the error?

Miguel_Angel_Baeyens

Hi,

Did you try the solution I suggested below? That's working for me in your file.

Miguel

Not applicable
Author

Hello Miguel,i've tried your answer

Sum({< date = {$(=Date(max([date])-1)) } >} sales)

but that didn't work for me. What i'm trying to do is select the sales from yesterday and i don't know what i'm doing wrong. I have to say that i am new with qlikview developer.

Miguel_Angel_Baeyens

Hi,

Then I recommend you to check this file that uses variables to get maximum and minimum dates, and uses set analysis.

Hope that helps.

Miguel

Not applicable
Author

Hello Miguel,you're example is much too difficult for me. I've just started yesteday with a selfstudy.

The only thing that i'm trying to do is: get the salesturnover from yesterday but i am not able to do so (even get today i cannot accomplish).

So the only thing i can produce in the definition is sum(sales). But how can i use a date within this formula?