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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Kaushik2020
Creator III
Creator III

Year calculation based on selected date

I have a scenario where i want to show the text label based on the below scenario. Please suggest.

YearQuarter
2024Q1
2024Q2
2024Q3
2024Q4
2025Q1
2025Q2
2025Q3

 

here we have 4-Quarters data for 2024 and 3-Quarters for 2025.

1. If the user selects Year as 2024, i should see the text label as 2024-Q4 as the max in Year 2024 is Q4. 

2. Approved data for 2025 we have till Quarter 2 only. i should see text label as 2025-Q2.

Thanks in advance.

 

Labels (4)
2 Replies
Amit_Prajapati
Contributor III
Contributor III

We can use the MaxString() function here.
When a user selects a year—like 2025

it will return the highest quarter for that year.

For example, if all quarters (Q1 to Q4) are available for 2025, it will show 2025 Q4 using this expression: =[_Fiscal Year] & ' ' & MaxString([Fiscal Quarter])

Amit_Prajapati_0-1755444196088.png

If I select Fiscal Year 2026 it will return Q2

Amit_Prajapati_1-1755444357604.png

Let me know if it's working in you case or not.

Vegar
MVP
MVP

You could pre-format a dual field for year quarter in the script.

LOAD 
   Dual(Year&'-'&Quarter ,Year&right(Quarter,1)) as Year_Quarter, 
   *
inline [
   Year Quarter
   2024 Q1
   2024 Q2
   2024 Q3
   2024 Q4
   2025 Q1
   2025 Q2
   2025 Q3
   ](delimiter  is ' ');

 

Then you could just use =maxstring(Year_Quarter) to fetch and present the lates year quarter value in your selection.