Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Help combining if statements

I am new to programming and would be grateful for any help combining the following two statements for my Dimension Year-

=if((left(Year,6)<>'Target' AND left(Year,4)<>'Proj'),Year)

 

=If(GetSelectedCount(Year)=0,
If(Year >= Year(Today())-6, Year, Null()),
Year

 

The first statement ignores any Years that start with the letters 'Target' and 'Proj'.

The second statement restricts the chart to showing a set number of years.

Thanks

Greg

4 Replies
sarvesh
Creator III
Creator III

You have >= instead of <=

Anonymous
Not applicable
Author

The two statements work independently but how do I combine the two statements?

sarvesh
Creator III
Creator III

could you share that file with me.

flipside
Partner - Specialist II
Partner - Specialist II

If you've got Years with text in them, I think you would be advised to look at your data first. It sounds like you need to create a new field in your load script flagging up Proj and Target, and have the year stored as a numeric only field.

Your expressions will be easier going forward.

flipside