Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis Expression Issue

Greetings my fellowmen and fair ladies!

Am having problems with a set analysis expression.

=count({$<Month={$(=only(Month))}>}TotalOrders)

It should give me the numbers of a previous month (if I select October, besides the actual result, it should return the results of the previous month for comparison).

Can anyone see where have I gone wrong?

Thank you very much in advance guys!

6 Replies
Not applicable
Author

If your month is a serial number this would work:

=count({$<Month={"$(=max(Month)-1)"}>} TotalOrders)

If not, you can create the serial number for month as (num(Month)+12*(Year-2006) assuming 2006 is your least year)and name it as MonthID.

In your function only(month) is returned only when one month is selected, but max will give you most recent for the selection which I think is better (Ofcourse you can reason it as business needs). Secondly you need to have only(Month)-1 for previous month.

Regards,

Kiran.

Not applicable
Author

Kiran, thank you very much for your reply!

But it havent worked... follows the screenshot

asehwhenaqfr.JPG

I think there's something wrong with the month... may be not considering something regarding it...

Can you see were have I gone wrong?

Thank you SO much!

Not applicable
Author

Just a format issue. Try the below set analysis:

{<Month={"$(=month(Only(Month)-1))"}>}

Kiran.

Not applicable
Author

Kiran, have tried but didn't work....

The Only(Month)-1 part is returning a number (in the example, '9')... could it be the problem?

Not applicable
Author

Check out what month(Only(Month)-1) is returning. It should return Sep for the expression to work.

If that doesnt work try month(Max(Month)-1))

Regards,

Kiran.

swuehl
MVP
MVP

Please note that month(Date) takes a Date as parameter.

Month(9) will probably return January (of year 1900).

Thiago, have you tried just removing the quotation marks (indicating a search string)?