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: 
Joo525
Contributor III
Contributor III

Filtering by Date

Hi everybody,

I have a table with rows "YEAR", "MONTH", "ARTICLES" and "NUMBER OF ARTICLES SOLD".

Now I want to make 4 filters that allow to select a start month with start year as well as end month with end year. So I want to get a selected time period for the articles and number of articles sold.  

I have defined 4 variables, one for each filter and two concates month with year (start and end). 

I have tried with set analysis as propertie of the filter. 

if(YEAR >= $(vFROM), YEAR) (example for the start year)

The filter doesn't show any data. 

I hope it is understandable what I need. Thank your for your help.

Labels (2)
1 Solution

Accepted Solutions
marcus_sommer

Assuming that the period-field and the variables are really numeric and within the range of each other the following should be working:

sum({<[JAHRMONAT] ={">=$(vVon)<=$(vBis)"}>} [S3510VER_MENGE])

 

View solution in original post

6 Replies
marcus_sommer

If year and month exists the user could simply select the wanted period. With makedate(YEAR, MONTH) could be also a date created which might be linked to a calendar with further period-information. Adding a start/end logic with n variables does not improve the usability else is rather the opposite.

Joo525
Contributor III
Contributor III
Author

I am sorry but I don't have an idea how that can wark.

Although it is in german, here a picture how the filter is suppost to look like.

Datumsfilter.JPG

 This is how my table looks like: 

Datumsfilter2.JPG

Now I want to filter how many articles were sold in the time persiod 12/2024 to 01/2025 (for example)

I hope that makes it clearer.

marcus_sommer

Just providing Year and Month as filter-fields and then selecting 2024 and 2025 from the Year and 1 and 12 from the Month.

The above will have limitations by certain year over-lapping periods but like hinted the Year and Month could be combined and then this field is used.

Joo525
Contributor III
Contributor III
Author

I am sorry, but that doesn't work, because when my "Start"-year is selected as 2024, Qlik won'r let my select the "End"-year 2025.

I have realized the whole filter with 4 varibles. When I put them together, I get the numbers as I want: 202501 (01/2025) for example, named vStart and vEnd. I have a row in my table which shows exactly that format for date named JAHRMONAT.

Now I try to get the mesaures that shows me the sum of "S3510VER_MENGE" regarding to the time period and the similar time periode one year ago. I tried 

sum({<[JAHRMONAT] ={'>=$(vStart),<=$(vEnd)'}>} [S3510VER_MENGE])

and 

sum({$<[JAHRMONAT] ={'>=$(vStartVGL)&<=$(vEndVGL)'}>} [S3510VER_MENGE])

(vStartVGL is defined as "=vStart - 100" and shows exactly what it is supposed to).

My table is empty. I have no idea, what I do wrong.

Thank you for your help.

marcus_sommer

Assuming that the period-field and the variables are really numeric and within the range of each other the following should be working:

sum({<[JAHRMONAT] ={">=$(vVon)<=$(vBis)"}>} [S3510VER_MENGE])

 

Joo525
Contributor III
Contributor III
Author

Thank you so much, it worked.