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

Show only names that exists in the current year (Pivot table)

Hi Masters

I have the table below (Pivot)

The dimension "Region" is a calculated dimension

=if(Mother_Vertical='Direct',Sub_Vertical)

"2019" formula:   

 sum({<Master_Month=,Master_Quarter=,Master_Week=>}Spread_over_COF_$)/sum({<Master_Month=,Master_Quarter=,Master_Week=>}R_ANI)

RegionTM Name2019
Rio de JaneiroEderson2.24%
Rio de JaneiroWeverton2.51%
Minas GeraisFabio2.49%
Minas GeraisDani Alves1.73%
Minas GeraisThiago Silva2.89%
Sao PauloMiranda2.36%
Sao PauloFilipe Luís2.84%
Sao PauloMarquinhos2.75%
Sao PauloDanilo2.48%
Sao PauloAlex Sandro2.38%
Sao PauloÉder Militão1.90%

 

Upon adding 2018 (below), the rows in blue appear (as those names existed in 2018)

"2018" formula:

Sum({1<Master_Year = {$(=$(vMaxYear)-1)}>}Spread_over_COF_$)/sum({1<Master_Year = {$(=$(vMaxYear)-1)}>}R_ANI)

However, I would like to NOT have those rows as I want to disclose only names that exist in 2019

RegionTM Name20192018
Rio de JaneiroEderson2.24%2.13%
Rio de JaneiroFabio-1.78%
Rio de JaneiroRamirez-1.70%
Rio de JaneiroWeverton2.51%2.50%
Minas GeraisFabio2.49%1.63%
Minas GeraisDani Alves1.73%1.74%
Minas GeraisThiago Silva2.89%-
Minas GeraisAlex-3.27%
Sao PauloMiranda2.36%1.98%
Sao PauloFilipe Luís2.84%2.86%
Sao PauloMarquinhos2.75%2.54%
Sao PauloDanilo2.48%1.95%
Sao PauloAlex Sandro2.38%1.97%
Sao PauloÉder Militão1.90%1.84%

 

How can I solve this issue?

Thanks for the help

1 Solution

Accepted Solutions
felipe_oliveira
Contributor III
Contributor III
Author

Thanks Rubenmarin,

 

I was able to fix it with this:

 

Sum({1<Master_Year = {$(=$(vMaxYear)-1),"TM Name"=P({1<Master_Year={$(=$(vMaxYear)}>} "TM Name")}>}Spread_over_COF_$)

/

sum({1<Master_Year = {$(=$(vMaxYear)-1),"TM Name"=P({1<Master_Year={$(=$(vMaxYear)}>} "TM Name")}>}R_ANI)

View solution in original post

3 Replies
rubenmarin

Hi, you can check value of 2019 column before calculating 2018, ie:
If(not Isnull([2019]), Sum({1<Master_Year = {$(=$(vMaxYear)-1)}>}Spread_over_COF_$)/sum({1<Master_Year = {$(=$(vMaxYear)-1)}>}R_ANI))

If '2019' is a calculated name, apply the same expression:
If(not Isnull([$(=NameExpression)]), ...
sivakumar1994
Contributor III
Contributor III

try this for 2018 expression:

if( not isnull([2019])
Sum({1<Master_Year = {$(=$(vMaxYear)-1)}>}Spread_over_COF_$)/sum({1<Master_Year = {$(=$(vMaxYear)-1)}>}R_ANI),0)
felipe_oliveira
Contributor III
Contributor III
Author

Thanks Rubenmarin,

 

I was able to fix it with this:

 

Sum({1<Master_Year = {$(=$(vMaxYear)-1),"TM Name"=P({1<Master_Year={$(=$(vMaxYear)}>} "TM Name")}>}Spread_over_COF_$)

/

sum({1<Master_Year = {$(=$(vMaxYear)-1),"TM Name"=P({1<Master_Year={$(=$(vMaxYear)}>} "TM Name")}>}R_ANI)