Skip to main content
Announcements
Qlik Community Office Hours - Bring your Ideation questions- May 15th, 11 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

SET ANALYSIS

Hello,

I need to add the value of a field with date restriction.

I am using SET ANALYSIS, I'm not getting more.

sum({$<DATA_EMISSAO = {'01/12/2010'} >} QUANTIDADE)



To my result even better, I need to date is as follows:

> = 01.12.2010 <01.01.2011

If anyone can help?



7 Replies
mike_garcia
Luminary Alumni
Luminary Alumni

Hi!

Two things you need to check:

- The Date format you assign to the Field Value definition in the Set Expression has to be exactly the same as the field is defined in the whole document. If it is DD/MM/YYY, don't use MM/DD/YYYY or DD.MM.YYYY.

- Try using double quotes instead of single quotes. If you are defining an interval with start and end date, the double quotes are mandatory, since it has to be defined as a Search String (double quotes = search string ; single quotes = literal value).

Hope this helps.

Mike.

Miguel García
Qlik Expert, Author and Trainer
Anonymous
Not applicable
Author

How would you set this in analiysis?

Anonymous
Not applicable
Author

I am using the following function:

sum

({$<DATA_EMISSAO = {">=(MonthStart(AddMonths(today(),(Meses))))<(MonthsEnd(1,Today(),(Meses)))" } >} QUANTIDADE)



where

MonthStart(AddMonths(today(),(Meses))) = 01/12/2010

MonthsEnd(1,Today(),(Meses)) = 31/12/2010

My problem is that she is not bringing results.





mike_garcia
Luminary Alumni
Luminary Alumni

Hi,

Try this:


Sum({$<DATA_EMISSAO = {">=($(=MonthStart(AddMonths(today(),Meses))))<($(=MonthsEnd(1,Today(),Meses)))" } >} QUANTIDADE)


What type of element is "Meses"? Is it a variable? Is it a field? If it is a field, is ther only one selected/possible value? Is it part of th chart's dimensions?

Mike.

Miguel García
Qlik Expert, Author and Trainer
Anonymous
Not applicable
Author

It is a variable.

I auditioned for the example that you posted more failed.

This way it works, so I can not set dates.

sum({$<DATA_EMISSAO = {">=01/12/2010<=31/12/2010" } >} QUANTIDADE)



mike_garcia
Luminary Alumni
Luminary Alumni

Ok, the only thing you need is to set the format to result of the expressions inside the value definitions.

This one takes care of that:

Sum({$<DATA_EMISSAO = {">=($(=Date(MonthStart(AddMonths(today(),Meses)), 'DD/MM/YYYY')))<($(=Date(MonthsEnd(1,Today(),Meses), 'DD/MM/YYYY')))" } >} QUANTIDADE)


Mike.

Miguel García
Qlik Expert, Author and Trainer
Anonymous
Not applicable
Author

This function is adding the field "QUANTIDADE" with the restrictions of the field "DATA_EMISSAO" the dates of beginning and end.