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: 
pankaj999
Contributor III
Contributor III

In Quarter Calculation

Hi Guys,

I have a problem with one of the logics that I need to place in my apps.

What I am trying to do is I need to calculate act_sales and est_sales based on the current quarter, Month and Day condition. Here’s what I am trying to achieve :

 

Conditions 1: When day of the current month is < = 8 and quarter = current quarter


for the current month (March)= sum of est sales

for last month (Feb)= sum of est sales

for prior to last month (Jan)= sum of actual sales

 

Conditions 2: When the day of the current month is >  8 and the quarter is the current quarter

 

for the current month (March)= sum of est sales

for last month (Feb) = sum of act sales

for prior to last month (Jan)= sum of  act sales

Else (if previous quarters selected) then

sum(act Sales)

 

Now, this has to be dynamic. For example, if I select the 2019 Q2 next month April then it should not calculate previous months in the sales sums as in the current quarter next month the last month is 0 .

Any idea how to achieve this ?

5 Replies
Shubham_Deshmukh
Specialist
Specialist

Pls share sample data
pankaj999
Contributor III
Contributor III
Author

here's the sample data looks like.

 

Shubham_Deshmukh
Specialist
Specialist

@pankaj999 ,

Is it correct (ignore prior to last month for now)? Just let me know,

deal.png

 

pankaj999
Contributor III
Contributor III
Author

yes, looks good

Shubham_Deshmukh
Specialist
Specialist

Great !!

Create variables like below,

deal.png

Current Month : exp1.png

Last Month : exp2.png

 

 

Regards,

Shuhbam