Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

set analisys

Hi,

I'm trying to use the following expression, but it doesn't work:

sum({<MY_YEAR={$(=Only(year(today())-1))}, MY_MONTH= {"<= 11 "}>} MY_VALUE    )

My aim is to calculate the sum of purchase, regarding the previous year and till november

Help please !!

Thanks in advance

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi

=month(today()) does not return 11 it returns nov.

Try:


          Num(month(today()))

Dennis.


View solution in original post

6 Replies
swuehl
MVP
MVP

You might cope with at least two pitfalls here:

- If user can select in any calendar field other than MY_YEAR and MY_MONTH, you need to explicitely clear these fields to avoid inconsistent selection state.

sum({<MY_YEAR={$(=Only(year(today())-1))}, MY_MONTH= {"<= 11 "}, MY_DATE= >} MY_VALUE)

- If MY_MONTH is not numeric only, but a dual, you might need to compare the text value in the set modifier (i.e. try using a numeric Month field).

I usually don't use year and month for set modification, but a Date field, then clear all other fields.

Hope this helps,

Stefan

Anonymous
Not applicable
Author

I'm sorry but I didn't catch what you mean.

I've to build two different expressions:

in the first case, the purchase amount for the whole 2011

in the secon case the pruchase amount till current month

So in the first case MY_YEAR is a DB field and MY_MONTH is needless

In the second expression, MY_YEAR is still a DB FIELD and MY_MONTH is the result of year(tiday())

I'm sorry but I'm really confused

Stefan

swuehl
MVP
MVP

It's up to me to be a little confused 😉

So in the first case MY_YEAR is a DB field and MY_MONTH is needless

In the second expression, MY_YEAR is still a DB FIELD and MY_MONTH is the result of year(tiday())

MY_MONTH is the result of year(today()) ? It's not a field in the data model describing a month?

Anonymous
Not applicable
Author

I'm sorry, I made a mistake. MY_MONTH is a DB field and represent the purchase_month.

For the current year, I've to sum all the purchase values, till the current month (month(today())

Anonymous
Not applicable
Author

Hi

=month(today()) does not return 11 it returns nov.

Try:


          Num(month(today()))

Dennis.


Anonymous
Not applicable
Author

Thanks very much!!

Stefan