I have a field called Period. starts from 202101 to 202204. I need to apply this period field in Filter section but I want to show only 12 months of data only(dynamically based on current month). For example, If I open that filter now, it needs to show 202105 to 202204(12 months). If I select next month, then it needs to show 202106 to 202205. dynamically it needs to show last 12 months period in filter.
This will give you the period you're looking for based on the maximum period in your data. The Date#( ) functions are to ensure Qlik translate your dates correctly for the monthstart( ) function.