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

Announcements
Streamlining user types in Qlik Cloud capacity-based subscriptions: Read the Details
cancel
Showing results for 
Search instead for 
Did you mean: 
A_PR
Contributor III
Contributor III

Custom Filter - Date Range

1000232556.jpg

 Hello All,

Please help me create a graph like this in Qliksense. I want the user to select the month in the filter. Eg. If Nov 2025 is selected.. it should show data from year start to month selected. Jan- Oct 2025. And a partition like line and the month selected from previous year and current year.

 

Thanks

PA

Labels (2)
1 Solution

Accepted Solutions
BIAKS
Contributor II
Contributor II

BIAKS_0-1767083704891.png

You can do something like this by using dimension reference line and set analysis.
If you have a master calendar you can add these dimensions:

Date(monthstart(TempDate),'MMM-YYYY') as MonthYear,
Date(monthstart(AddYears(TempDate,-1)),'MMM-YYYY') as LastMonthYear,
Date(YearStart(TempDate),'MMM-YYYY') as YearStartMonth,

for the expression you can do something like this:

Sum({<MonthYear={">=$(=YearStartMonth)<=$(=GetFieldSelections(MonthYear))"}>+<MonthYear={"$(=LastMonthYear)"}>} Expression1)

you can see that we added the previous year's same month with: 

+<MonthYear={"$(=LastMonthYear)"}

for the sorting, use sort by expression on MonthYear and write this:

Match(Only({1} MonthYear),'$(=MonthYear)', '$(=LastMonthYear)', MonthYear)

for the coloring, I used this:

If(Max({1} CalendarDate)>YearStart(Today()),Blue(),Green())

and finally for the dimension reference line, you can use the following:

=MonthStart(Max({<MonthYear={"<=$(=GetFieldSelections(MonthYear))"}>} CalendarDate))

If you cant see anything, try selecting a "MonthYear" first.

Hope this works for you.

View solution in original post

3 Replies
BIAKS
Contributor II
Contributor II

BIAKS_0-1767083704891.png

You can do something like this by using dimension reference line and set analysis.
If you have a master calendar you can add these dimensions:

Date(monthstart(TempDate),'MMM-YYYY') as MonthYear,
Date(monthstart(AddYears(TempDate,-1)),'MMM-YYYY') as LastMonthYear,
Date(YearStart(TempDate),'MMM-YYYY') as YearStartMonth,

for the expression you can do something like this:

Sum({<MonthYear={">=$(=YearStartMonth)<=$(=GetFieldSelections(MonthYear))"}>+<MonthYear={"$(=LastMonthYear)"}>} Expression1)

you can see that we added the previous year's same month with: 

+<MonthYear={"$(=LastMonthYear)"}

for the sorting, use sort by expression on MonthYear and write this:

Match(Only({1} MonthYear),'$(=MonthYear)', '$(=LastMonthYear)', MonthYear)

for the coloring, I used this:

If(Max({1} CalendarDate)>YearStart(Today()),Blue(),Green())

and finally for the dimension reference line, you can use the following:

=MonthStart(Max({<MonthYear={"<=$(=GetFieldSelections(MonthYear))"}>} CalendarDate))

If you cant see anything, try selecting a "MonthYear" first.

Hope this works for you.

A_PR
Contributor III
Contributor III
Author

@BIAKS This was perfect, Thank you so much. Would it be possible to show Nov 2024 first and then Nov 2025? 

BIAKS
Contributor II
Contributor II

You can change dimension reference line formula to this:

=MonthStart(Max({<MonthYear={"<=$(=Date(AddYears(Date#(GetFieldSelections(MonthYear),'MMM-YYYY'),-1),'MMM-YYYY'))"}>} CalendarDate))

And Sorting of the MonthYear to this:

Match(Only({1} MonthYear), '$(=LastMonthYear)', '$(=MonthYear)', MonthYear)

But this will show the selected value as last year's MonthYear, so you can hide the value for not to get confused.