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: 
deepakqlikview_123
Specialist
Specialist

Need to show data only for even years for expression 4

PFA.

I have 4 expressions in a chart

as per requirement I Need to show data only for even years for expression 4

Can you please suggest how shall i go ahead.


Thanks

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try :

=(Avg({<INDICATOR_NAME={'Sum of Attributions (Growth)'},QUARTER={'Q4'},YEAR={"=Even(YEAR)"}>}INDICATOR_VALUE))/100

View solution in original post

4 Replies
teiswamsler
Partner - Creator III
Partner - Creator III

Hi Deepak

This is not the most elegant solutions, but you can flag the even years like this, and then use the flag i the set analysis.

Test:
LOAD * INLINE [
YEAR
1902
1903
1904
1905
]
;

join
Load
YEAR,
Right(YEAR/2, 2) as Test,
IF( Right(YEAR/2, 2) = '.5', 0, 1 ) as _EvenFlag
Resident Test;

/Teis

parthakk
Creator II
Creator II

Hi Deepak,

Write the following expression for 4

IF(mod(YEAR,2)=0,(Avg({<INDICATOR_NAME={'Sum of Attributions (Growth)'},QUARTER {'Q4'}>}INDICATOR_VALUE))/100,)

See the attached file

Thanks,

Partha K

tresesco
MVP
MVP

Try :

=(Avg({<INDICATOR_NAME={'Sum of Attributions (Growth)'},QUARTER={'Q4'},YEAR={"=Even(YEAR)"}>}INDICATOR_VALUE))/100

sudeepkm
Specialist III
Specialist III

EDIT: Sorry didn't see TeisWamsler suggestion. Deepak, That's the solution I'm referring to.

I think it would be good to identify a year as even or odd at the script level.

While loading data check if the YEAR is even (by using even function) and then flag it as 1 and rest all years as 0 and bring this flag as a new field.

In your expression you can use this flag to restrict the output to only even years.