Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
vanderson009
Creator III
Creator III

Set Analysis

Hello guys,

What is wrong with this set exression,

=sum({<Month={">=$(=date(addMonths(Max(Month),-1),'MMM YYYY'))"}>}sales)

It's not reflecting with any sales value, its shows me 0 as sales value.

-- Thanks,

Villyee

7 Replies
its_anandrjs

You are not get proper value in =date(addMonths(Max(Month),-1),'MMM YYYY') what is your expected value let me know.

Not applicable

Can you please share the sample file

its_anandrjs

With month value you are comparing

Month = MMM YYYY

But month fields values are 1,2,3,4....

What is expected value and output.

vanderson009
Creator III
Creator III
Author

Hi anand,

Month field having values as Jan 2014, Feb 2014 and so on.....

so i make formate as MMM YYYY.

- Thanks

Villyee

its_anandrjs

Then use Year field in the SET expression also.

vanderson009
Creator III
Creator III
Author

Hi anand thanks for your reply.

but i didnt understand what the sense of using Year field.

Can you please elaborate me.

- Thanks

Villyee

jagan
Luminary Alumni
Luminary Alumni

Hi Villyee,

In script arrive a new date field like this

TableName:

LOAD

*,

MakeDate(Right(MonthFieldName, 4), Match(Left(MonthFieldName, 3), 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec')) AS DateFieldName

FROM DataSource;

Now use this expression

=sum({<DateFieldName={">=$(=AddMonths(Max(DateFieldName),-1))"}>}sales)


Hope this helps you.


Regards,

Jagan.