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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
segerchr
Contributor III
Contributor III

Set analysis monthly story

Hi Com,

i am searching for a peace of code in set analysis.

I have a field dateinvoice. It is a regular german date format: 26.11.2015.

Now i need a formula to display all invoices in 2016 and later for 2016 in november. .

Looks like this formula, but nothings happend.

Sum({<dateinvoice={$(=year(Today())}>costs)

Can someone help me ?

Thanks

1 Solution

Accepted Solutions
sunny_talwar

I would suggest creating a Year field in the script using Year() function:

Year(dateinvoice) as Year

and then use this in your set analysis:

Sum({<Year = {$(=If(Month(Today()) >= 11, Year(Today() + 1), Year(Today())))}>}costs)

View solution in original post

5 Replies
tresesco
MVP
MVP

For all invoices in 2016:

Sum({<dateinvoice={'>=$(=yearstart(Today())) <=$(=yearend(Today()))'}>costs)


For 2016, Nov:


Sum({<dateinvoice={'>=$(=Monthstart(Today(),9)) <=$(=Monthend(Today(),9))'}>costs)

Edit: Corrected some brace errors.

sunny_talwar

I would suggest creating a Year field in the script using Year() function:

Year(dateinvoice) as Year

and then use this in your set analysis:

Sum({<Year = {$(=If(Month(Today()) >= 11, Year(Today() + 1), Year(Today())))}>}costs)

segerchr
Contributor III
Contributor III
Author

Ok Thanks for your answers.

I would use this code for a QlikSense Story, so the code shoud not be static.

That means, when today it is November the visualisation should show november. But in one month the app should display december without editing code.
In your code the visualisation will be always on November. Isnt it ?

sunny_talwar

Nope, it will change based on which month you open the app. Up until 31st Oct you will see this year's data (2016). As soon as you open the app on 1st Nov, you will start seeing 2017 data.

segerchr
Contributor III
Contributor III
Author

Many thanks it works.

CS