Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
pnn44794
Partner - Specialist
Partner - Specialist

How To Limit Data In Straight Table Based On Date

Hello:

 

I have a straight table with 2016 and 2017 data.  I'd like to limit the data to just data from 2017.  The field I'm trying to use is Approved_YearMonth which is in the format of YYYYMM, i.e. 201701, 201702, etc.

 

In the straight table, I've entered =Date(MonthStart(Approved_YearMonth), 'YYYYMM') as a dimension with the label of Approved_YearMonth.

 

 

As always, thanks in advance for any and all help.

 

1 Solution

Accepted Solutions
vishsaggi
Champion III
Champion III

Try like:

= IF(WildMatch(Approved_YearMonth, '2017*') > 0, Approved_YearMonth)

OR

= IF(Left(Approved_YearMonth, 4) = '2017', Approved_YearMonth)

View solution in original post

5 Replies
vishsaggi
Champion III
Champion III

Try like:

= IF(WildMatch(Approved_YearMonth, '2017*') > 0, Approved_YearMonth)

OR

= IF(Left(Approved_YearMonth, 4) = '2017', Approved_YearMonth)

pnn44794
Partner - Specialist
Partner - Specialist
Author

Hello Vishwarath:

 

Both expressions work.  Thank you very much!

 

Again, thank you very much for your help.

vishsaggi
Champion III
Champion III

For your 2nd Question you can use something like this:

Create a variable in the Script or using Variable Overview (Ctrl+Alt+V) then add the variable.

In Script

LET vCurrentYear = Year(Today());

In Variable Overview window add

vCurrentYear

your expression should be = Year(Today()).

Then you can use that variable like

= IF(Left(Approved_YearMonth, 4) = vCurrentYear, Approved_YearMonth).

For your 1st Question, i need to look into your sample app. Can you share your application if possible?

pnn44794
Partner - Specialist
Partner - Specialist
Author

A variable.  Good idea.  Then I never have to change it or worry about the year.  Thanks for the pointer.

In regards to my first question, I'm not going to worry about it at the moment.  I don't think it's a big deal and I can't share my App unfortunately.  Company rules.

I'll mark your first response as Correct and your last response as helpful.  Thank you again.

vishsaggi
Champion III
Champion III

No problem. Glad it worked for you.