Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
JulieMcD240
Contributor II
Contributor II

Help with a query

Hello everyone,

I have a table with muliple databases and each database has multiple tables with multiple rows based on dates.  What I want to do is extract one database with distinct table values based on the max date for each table.  an example is:

 

database             tableName         date

database A          Table A                 1/9/2023

database A          Table A                 1/16/2023

database A          Table B                 1/9/2023

database A          Table B                 1/16/2023

database A          Table C                 1/9/2023

database A          Table C                 1/16/2023

database B          Table D                 1/9/2023

database B          Table D                 1/16/2023

database C          Table E                  1/9/2023

Database C          Table E                  1/16/2023

 

The result I want is:                             

database              Distinct Table Name       Max Date

database A          Table A                                 1/16/2023

database A          Table B                                 1/16/2023

database A          Table C                                 1/16/2023

 

I started with this this but not getting the outcome I want.

=if(Match(database, 'database A'), only(distinct tableName))

 

Any help would be greatly appreciated.  Thank you.

Labels (1)
1 Reply
ogster1974
Partner - Master II
Partner - Master II

In the script cant you just group and max?

Table:

Load

database,

tableName,

Max(Date) as "Max Date"

Resident tmpTable

Where Match(database, 'database A')

Group by

database,

tableName

;