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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Select max value of a child

[English first,

French below]

Hi everyone,

I got a problem to select the max value of a child.

I know its not very clear, ill try to explain my thought.

Data:

a Domain own a DomainStatus and a few Rules ( each Rule may have more than one exec )

a Rule own a RuleStatus and an ExecutionDate.

In the bellow exemple, the Domain only have 1 Rule, but that Rule ave 4 executions.

I forgot to mention that for the first table, depending status :

OK : green

KO : red

- : yellow

Capture.PNG.png

I want my first table to display the RuleStatus of the most recent execution only and ignore older executions.

Iv tried some things but coulnd figure it out.

What would be the definition of the expression of RuleStatus ?

Thanks!

Ulysse

_______________________________________________________________________________

Bonjour à tous,

J'ai un soucis pour ne selectionner que la valeur max d'un child d'un enregistrement.

Bon c'est pas très clair, je vais essayer de détaillé ça :

Données:

un Domain possède un StatusDomain et un ensemble de plusieurs Rule (et une Rule peut avoir plusieurs executions).

une Rule possède un StatusRule et une date d'execution.

Dans l'exemple, le Domaine n'a qu'une seule Rule, mais cette dernière a plusieurs date d'execution.

Capture.PNG.png

Actuellement , je souhaite avoir dans le tableau du haut uniquement le StatusRule de l'execution la plus récente.

En soit c'est tout simple, n'afficher que le StatusRule where max DateExec.

J'ai fait plusieurs essais infructueux, raison pour laquelle je me tourne vers la communanuté

Quel serait la définition de l'expression de StatusRule ?

Merci d'avance,

Ulysse

Ce message a été modifié par : Ulysse ROLAND english written

1 Solution

Accepted Solutions
MarcoWedel

Hi,

maybe like this?:

QlikCommunity_Thread_131103_Pic1.JPG.jpg

hope this helps

cordialement

Marco

View solution in original post

10 Replies
avinashelite

Can you please post your app.

Not applicable
Author

Id prefer to avoid that option, im under confidentiality restrictions i cant bypass.

If you really need it, i will clean it and upload it.

PrashantSangle

Hi,

Did you try with FirstSortedValue()?

Try this in Dimension Tab.

firstsortedvalue ( Rule, DateExecution) 

For more details see in help Menu

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable
Author

Here the app cleaned

Capture.PNG.png

The script :

domain:

LOAD * INLINE [

domain, domainStatus

domain1, OK

domain2, KO

]

;

OUTER JOIN (domain)

LOAD * INLINE [

domain, rule, ruleStatus, execDate

domain1, rule1, KO, 2014-08-20

domain1, rule1, KO, 2014-08-21

domain1, rule1, OK, 2014-08-26

domain1, rule2, KO, 2014-08-22

domain1, rule2, OK, 2014-08-24

domain2, rule3, KO, 2014-08-19

]

;

Not applicable
Author

When i read your post and doc this seems to be the exact solution, but i failed to implement it.

I have tried using FirstSortedValue() over the dimension and the expressions, both failed to render the expected value.

(with the app i uploaded on gdrive)

- I tried on dimension FirstSortedValue(rule, execDate)

- and also on expression FirstSortedValue(ruleStatus, execDate)

I know thats kinda a basic case, and im missing something..

Not applicable
Author

=FirstSortedValue(ruleStatus, execDate) is working in expression

I didnt see it the first time... white text color on yellow background 😕

my bad!

Thanks for your answers!

Ulysse

MarcoWedel

Hi,

maybe like this?:

QlikCommunity_Thread_131103_Pic1.JPG.jpg

hope this helps

cordialement

Marco

MarcoWedel

for the most recent execution date try with negative execDate values:

=FirstSortedValue(ruleStatus, -execDate)


cordialement


Marco

Not applicable
Author

Thats it!

Thank you Marco