Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
fierbinteanua
Contributor
Contributor

Total value of Current Quarter + total value of all previous quarter

Hi everybody,

 I have an issue , this is the data that i want to have  but is base on a expression with static variable, 

and if i put dynamic variable in a bar char it give me the Q 2 19  quarter  values (first row) , i need all the quarter (o put in  my formula :


count ( DISTINCT
total {1<C_Quarter=, flag_date={0}, C Fiscal Quarter number={">=$(v Dynamic Quarter 4) <=$(v Dynamic Quarter)"},

C Q Fiscal Quarter number={"<=$(v Dynamic Quarter) >=9999"}>} NUMBER)

/

count
(total DISTINCT
{1< C_Quarter=, C Fiscal Quarter number={">=$(v Dynamic Quarter 4) <=$(v Dynamic Quarter)"},

c Q Fiscal Quarter number={"<=$(v Dynamic Quarter) >=9999"}>} NUMBER)

Where

v Dynamic Quarter=max(C Fiscal Quarter number)

v Dynamic Quarter 4=max(C Fiscal Quarter number)-4

and 9999 are null values;

 

 

C_Quartertotalrespondcolumn(2)

/
column(1)
Q 2 191272835727245.0%
Q 1 19981664235843.1%
Q 4 18679142464936.3%
Q 3 18382481230032.2%
Q 2 181489611587.8%
    
    

 

One solution is that i use pick(match(quarter,'Q 2 19','Q 1  19'...),

and add the expression from above with static variable for every Q and it works

But searching the web i found  :

 


range sum(
count(distinct {<flag_date={0}, C Fiscal Quarter number ={">=$(=$(d Quarter 4)) <=$(=$(d Selected Quarter))"},cQ Fiscal_Quarter number ={"<=$(=$( d Selected Quarter)) >=9999"}>} NUMBER)
,below(
range sum(
count( distinct {<flag_date={0}, C Fiscal Quarter number ={">=$(=$(d Quarter 4)) <=$(=$(d Selected Quarter))"},c Q Fiscal Quarter number ={"<=$(=$(d Selected Quarter)) >=9999"}>} NUMBER))
)
)

 

where d Selected Quarter and d Quarter 4 are dynamic variable =max(C Fiscal Quarter number ) , max(C Fiscal Quarter number )-4 (without 😃 created in "front".

but i doesn't give me 

 

I want to use a count(NUMBER) where C Fiscal Quarter number is between current quarter and four previous quarters, with a flag_date =0(not important) and 

the second filter is c Q Fiscal_Quarter number <= current quarter    >=9999 (null values) . c Q_Fiscal_Quarter number and from a second calendar . 

I have added am excel with the demo data. For a better selection you have to select the current  quarter and all the previous quarter for C Fiscal Quarter number  and from c Q Fiscal Quarter number  the same selection + 9999 and flag =0
thank you.

Adrian

0 Replies