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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Kaushik2020
Creator III
Creator III

Incorrect data showing in table for rolling 12 months

Dear all, I am using below set expression for calculate rolling 12 months.

count({$<Year=, Month=, Day=,MonthYear=,
Date={">=$(=addMonths(max(Date),-12)) <= $(=max(Date))"}>}
distinct Txt_IssueID)

I have a table where i have dimension as MonthYear &  measure which is mentioned above.

Now in UI i have a filter pane with year, month. When I selected Month as Feb. expectation is that the table should show data between Feb 2022 till Feb 2023. If i see the date range in the expression editor window it is showing correctly. 

But when i see the records in the table it is not showing correctly, Can anyone suggest the reason for the same ? 

 

Thanks in advance. 

Labels (4)
1 Solution

Accepted Solutions
Kaushik2020
Creator III
Creator III
Author

I found one from @sunny_talwar  post back in 2019 which resolved this. below is how the complete version look like.

Count({<Year, Month, Week, Quarter,
Date={"$(='>=' & Date(MonthStart(addmonths(Max(Date), -12))) & '<' & Date(Max(Date)))"}>}
distinct Txt_IssueID)

 

https://community.qlik.com/t5/New-to-Qlik-Sense/Rolling-12-months-dynamically-when-month-selected/td...

 

View solution in original post

5 Replies
PrashantSangle

it is because you have nullify the selection in set analysis.

Remove "Year=, Month=, Day=,MonthYear=,"

 

Regards,

Prashant Sangle

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Kaushik2020
Creator III
Creator III
Author

thanks for your revert. when i removed the parameters and  checked, below is what i get,

 

kaushi2020_0-1701865827078.png

Count({<
Date={">=$(=addMonths(max(Date),-12)) <= $(=max(Date))"}>}distinct Txt_IssueID)

sidhiq91
Specialist II
Specialist II

@Kaushik2020  Please remove Year=, Month=, Day=,MonthYear= from your Set Modifier and that should resolve the issue.

 

Kaushik2020
Creator III
Creator III
Author

thanks for your reply, when i removed those filters, I can see only Feb-2022 and Feb-2023. 

Below is output and set expression for your reference. 

 

Count({< Date={">=$(=addMonths(max(Date),-12)) <= $(=max(Date))"}>}distinct Txt_IssueID)

kaushi2020_0-1701866194158.png

 

Kaushik2020
Creator III
Creator III
Author

I found one from @sunny_talwar  post back in 2019 which resolved this. below is how the complete version look like.

Count({<Year, Month, Week, Quarter,
Date={"$(='>=' & Date(MonthStart(addmonths(Max(Date), -12))) & '<' & Date(Max(Date)))"}>}
distinct Txt_IssueID)

 

https://community.qlik.com/t5/New-to-Qlik-Sense/Rolling-12-months-dynamically-when-month-selected/td...