Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Restrict Dimension by max(Date)

Dear all,

I have Excel-data, that looks like this:

ProjektRechnungsdatumName
101.01.20181. Rechnung
102.01.20182. Rechnung
108.01.20183. Rechnung
231.01.20181. Rechnung

The result (just a usual table in QLIK) shall look like this:

ProjektRechnungsdatumName
108.01.20183. Rechnung
231.01.20181. Rechnung

So I just want the latest data to be shown outgoing from the date of invoice (Rechnungsdatum). I thought about creating a dimension for "Name", but as I am missing a command as "for" I don't know how to do it. Would be great if you can help.

Greetings,

Tom Müller

1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

Try adding a DISTINCT to see if that works

FirstSortedValue(DISTINCT Name, -Rechnungsdatum)

View solution in original post

5 Replies
dionverbeke
Partner - Creator III
Partner - Creator III

there are several ways to do this, the easiest is to precalculate with firstsortedvalue.

https://help.qlik.com/en-US/sense/September2017/Subsystems/Hub/Content/Scripting/AggregationFunction...

Remember: everything you do in the front-end is calculated at runtime. It is therefore advised to do the calculation in the Qlik script.

agigliotti
MVP
MVP

maybe this:

t1:

load

*

from your_table;

left join

load

projekt,

max(Rechunungsdatum)  as your_last_date

resident t1 group by projekt;

t2:

load

*

where your_flag = 1;

load

*,

if( Rechunungsdatum = your_last_date, 1, 0 ) as your_flag

resident t1;

drop table t1;

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it
sunny_talwar
MVP
MVP

May be try this

Dimension

Projekt

Expression

Max(Rechnungsdatum)

FirstSortedValue(Name, -Rechnungsdatum)


Capture.PNG

Anonymous
Not applicable
Author

Thanks for the help, when I use FirstSortedValue this is the result.

sorted.JPG

I would really like to use it as a dimension, as I will leave my employer very soon and I think the further users will understand a dimension better than changes in the script. The loading time shouldn't be a problem.

sunny_talwar
MVP
MVP

Try adding a DISTINCT to see if that works

FirstSortedValue(DISTINCT Name, -Rechnungsdatum)