Qlik Community

Ask a Question

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
sunainapawar
Creator
Creator

FYear calculation based on Quarters and months

Hello All,

I need assistance in one scenario.

For Quarter calculation, we are doing as below. we are basically doing average for each month. 

If the Quarter is a completed Quarter, we divide it by 3. If Quarter is current Qtr then for first month of Qtr say it is Apr then Sum(Apr), When we enter May, it is (Apr+May)/2, for Jun (Apr+May+Jun)/3. I have done by creating a variable as below and used in expression. 

if(mod(num(month(max(MonthYear_S))),3)=0,3,
mod(num(month(max(MonthYear_S))),3))

Now same has to be done for FYear calculation. When the Year is completed we divide it by 4. But for Current Year, the calculation should be as below. 


Q1
Apr-Apr
May-(Apr+May)/2
June-(Apr+May+June)/3

Q2
Jul-((Q1/3)+Jul)/2
Aug-((Q1/3)+(Jul+Aug)/2)/2
Sept-((Q1/3)+(Jul+Aug+sept)/3)/2

Q3
Oct-((Q1/3)+(Q2/3)+Oct)/3
Nov-((Q1/3)+(Q2/3)+(Oct+Nov)/2)/3
DEc-((Q1/3)+(Q2/3)+(Oct+Nov+Dec)/3)/3

Q4
Jan-((Q1/3)+(Q2/3)+Jan)/4
Feb-((Q1/3)+(Q2/3)+(Jan+Feb)/2)/4
Mar-((Q1/3)+(Q2/3)+(Jan+Feb+Mar)/3)/4

Can anyone assist please. 

2 Replies
sunainapawar
Creator
Creator
Author

Hello,

Any suggestions.

sunainapawar
Creator
Creator
Author

Hello All,

Any suggestions. I have created a variable for division of each quarter. Like for Q1 divide by 1, Q2 divide by 2, Q3 divide by 3 and Q4 divide by 4 using mod. 

if(
mod(max(FQuarter_S),4)=0,4,
mod(max(FQuarter_S),4))

This gives me 1,2,3,4 as output.

I am stuck at building a logic to calculate the below. 

like for Q2- how to calculate Q1/3, same way when we go in Q3, Q1/3+Q2/3, likewise for Q4-Q1/3+Q2/3+Q3/3

Thanks in advance. any help would be much appreciated.