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: 
Anonymous
Not applicable

Selection based on other values in table

Hello,

I have a table that looks like this:

In the GUI when i choose december 2014 i want the GROUP that has the TYPE = T to show, hence K. As you can see there are two different groups that are available by december 31st.

Just want to make clear that i want this solution in the script. Otherwise i would just select T from the TYPE listbox . This is just on of many ITEMS just to be clear 'bout that too.

I've tried some previous statments in the script but ive only manage to pin point the TOM that has duplicates but i don't know where to go from there.

Thank you!

1 Solution

Accepted Solutions
JonnyPoole
Former Employee
Former Employee

So you want to be able to select the month of 'TOM' and while doing it, it also passes the 'Type' context.

If your load has

Table:

Load

     Item,FOM,TOM,GROUP,TYPE

from <>

You can try

Table:

Load Item,FOM,TOM,GROUP,TYPE,

        autonumber(monthname(TOM)&TYPE,'MonthTypeKey') as MonthTypeKey

from <>

NewTable:

     Load

          MonthName(FOM) as FOMMonthName,

          MonthTypeKey

resident Table

where TYPE='T';

And then use 'FOMMonthName' as your key .... it should filter for FOM values in the selected month where TYPE is also 'T'.

It MAY leave some gaps in the months requiring you to generate a date table and outerjoin it to 'newtable' so that all MonthTypes appear.

View solution in original post

5 Replies
JonnyPoole
Former Employee
Former Employee

So you want to be able to select the month of 'TOM' and while doing it, it also passes the 'Type' context.

If your load has

Table:

Load

     Item,FOM,TOM,GROUP,TYPE

from <>

You can try

Table:

Load Item,FOM,TOM,GROUP,TYPE,

        autonumber(monthname(TOM)&TYPE,'MonthTypeKey') as MonthTypeKey

from <>

NewTable:

     Load

          MonthName(FOM) as FOMMonthName,

          MonthTypeKey

resident Table

where TYPE='T';

And then use 'FOMMonthName' as your key .... it should filter for FOM values in the selected month where TYPE is also 'T'.

It MAY leave some gaps in the months requiring you to generate a date table and outerjoin it to 'newtable' so that all MonthTypes appear.

Anonymous
Not applicable
Author

I have a calender connected to the datat in the application where i choose month and Year. And that is connected to FOM and TOM through a interval match to fill the gaps.

My main issue is that when chosing december 2014 i get two groups right now and i only want to have the one with the TYPE = T.

JonnyPoole
Former Employee
Former Employee

The technique i described above would cause this effect throughout the app:

-> Whenever an FOM month was selected, you would filter the current state for records from that month that had TYPE=T. It would be global because its driven by a data model association that ties Type=T to month.

Is that what you want for the whole app ?

Or when you select a month (any month) you want just one chart to show records for that month where (additionally) Type=T.

Anonymous
Not applicable
Author

I read my post again thinking i might not have been that clear..

I only want to choose records with TYPE=T when there are records that have duplicates of the FOM date.

What i want is that when i choose a month i want the correct GROUPS shown in the dimension in a chart.

Anonymous
Not applicable
Author

Looks like it's working! Thanks! I added a field that checks if there's dublicates of the TOM date in order to only mark those as the once where TYPE = T is also used.

Thanks a million!

//A.