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: 
PepeMontes
Partner - Contributor III
Partner - Contributor III

Calculate quarters depending selected month

Hello all,

I want to calculate  my quarters into my table measures depending on the selected month into my app, I'm using the next function in for the first Quarter:

if(Month > '3',Sum({$< Year={$(=Max(Year))} ,Month = {$(=Month(Date#(Max(Month)-2, 'M'))),$(=Month(Date#(Max(Month)-1, 'M'))),$(=Month(Date#(Max(Month), 'M')))}>} [CantidadVen]), if(Month <='3', Sum({$< Year={$(=Max(Year)-1)} ,Month = {$(=Month(Date#(Max(Month)+10, 'M'))),$(=Month(Date#(Max(Month)+11, 'M')))},Year={$(=Max(Year))},Month = {$(=Month(Date#(Min(Month), 'M')))}>} [CantidadVen]),0 ) )

But this not getting to me the result what im looking for.

Someone did calculate Quarters depneding on the selected month  before?

I will apprecciate alot your help. Regards.

Labels (1)
4 Replies
anushree1
Specialist II
Specialist II

why dont you extract the quarters in the load script itself.

it can be done like :

'Q' & CEIL(NUM(MONTH(CALENDAR_DATE))/3) AS CALENDAR_QUARTER,

PepeMontes
Partner - Contributor III
Partner - Contributor III
Author

Hello i already tried this,

But load this into the script only will give me static Quarters(Jan-Marc,Apr-Jun,Jul-Sep,Oct-Dec) i want dynamic quarters like, if i select january into the months the first quarter should be (Jan2020-Nov2019) and before.

 

Rergards

anushree1
Specialist II
Specialist II

hows your Financial year defined?

Does nov 2019 - jan2020 mean Quarter 1 for you?

PepeMontes
Partner - Contributor III
Partner - Contributor III
Author

Not really

Let me me give you an example, the final user select april 2019, so my frist quarter should be (Apr2019-Feb2019) the next quarter(Jan2019-Nov2018) next one (Oct2018-Aug2018) and the last one (Jul2018-May2018) but the final user want to change the selected month to January 2020, so the period should change, the first quarter should be (Jan2020-Nov2019) and etc.

Regards