Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
MJansen
Contributor
Contributor

Show specific field according to expression

Hi all,

It is a little bit hard to explain, but I am combining several rows in my Qlik Sense table to check if one row is 'wrong' compared to another row. 

The expression I made works and shows me the wrong row (based on date, Actiestatus, Accoord status) as expected. If every row is wrong, there is 'all rows wrong'. However, I don't want to see the date, but I want to see the 'user' as output. And better, if there is a date, I just want to see the (1) user of the wrong row. See the table for an example. In this example you see sets of two, based on number. In colomn 'Wrong date' you see the outcome of this expression:

The expression that works. Some words are in Dutch:

=If((aggr(min({<[Accoord status]=,Actiestatus=,[Typecode]={'P'},[Statuscode]={'A'}>} [Date]),Prkcode,Number)<>aggr(min([Date]),Prkcode,Number)),'all rows wrong',
aggr(max([Date]),Prkcode,Number))

So hopefully someone can help me with showing the user instead of the date.

 

Date Number Accoord status User Prkcode Aantal dubbele MO's Wrong date Statuscode Typecode
29-11-2023 6151 Niet geaccordeerd Eijkeren 00000108 2 28-02-2024 A P
28-2-2024 6151 Niet geaccordeerd Koff 00000108 2 28-02-2024 A P
27-10-2023 3224 Niet geaccordeerd Eijk 00000213 2 all rows wrong A P
28-3-2024 3224 Niet geaccordeerd Egmond 00000213 2 all rows wrong A P
18-8-2023 1777 Niet geaccordeerd Tas 00000353 2 21-08-2023 A P
21-8-2023 1777 Niet geaccordeerd Ramic 00000353 2 21-08-2023 A P
2-10-2023 1497 Niet geaccordeerd Eijkeren 00000353 2 04-10-2023 A P
4-10-2023 1497 Niet geaccordeerd Lemmens 00000353 2 04-10-2023 A P
22-1-2024 9700 Niet geaccordeerd Stammeshaus 00000353 2 19-03-2024 A P
19-3-2024 9700 Niet geaccordeerd Sleutjes 00000353 2 19-03-2024 A P
15-5-2024 1768 Niet geaccordeerd Janssen 00000353 2 22-05-2024 A P
22-5-2024 1768 Niet geaccordeerd Oudenhuijsen 00000353 2 22-05-2024 A P
28-6-2024 2589 Niet geaccordeerd Bavel 00000353 2 30-06-2024 A P
30-6-2024 2589 Niet geaccordeerd Es 00000353 2 30-06-2024 A P
7-7-2024 7261 Niet geaccordeerd Pruissers 00000353 2 10-07-2024 A P
10-7-2024 7261 Niet geaccordeerd Oetelaar 00000353 2 10-07-2024 A P
25-7-2024 5227 Niet geaccordeerd Pepping 00000353 2 all rows wrong A P
12-8-2024 5227 Niet geaccordeerd Egmond 00000353 2 all rows wrong A P
22-4-2024 8439 Niet geaccordeerd Zwarteveen 00000477 2 all rows wrong A P
5-7-2024 8439 Niet geaccordeerd Oetelaar 00000477 2 all rows wrong A P
23-8-2023 1782 Niet geaccordeerd Verbiesen 00000507 2 30-08-2023 A P
30-8-2023 1782 Niet geaccordeerd Koff 00000507 2 30-08-2023 A P
27-3-2024 5350 Niet geaccordeerd Oudenhuijsen 00000507 2 15-05-2024 A P
15-5-2024 5350 Niet geaccordeerd Eijkeren 00000507 2 15-05-2024 A P
Labels (3)
1 Solution

Accepted Solutions
Anil_Babu_Samineni

looks like the condition is valid but due to limitation in dimension for aggregated calculation, perhaps try this?

=Aggr(If((aggr(min({<[Accoord status]=,Actiestatus=,[Typecode]={'P'},[Statuscode]={'A'}>} [Date]),Prkcode,Number)<>aggr(min([Date]),Prkcode,Number)),'all rows wrong',

Firstsortedvalue(User, -aggr(max([Date]),Prkcode,Number)), Prkcode,Number)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

4 Replies
Anil_Babu_Samineni

Perhaps this If i understand correctly?

=If((aggr(min({<[Accoord status]=,Actiestatus=,[Typecode]={'P'},[Statuscode]={'A'}>} [Date]),Prkcode,Number)<>aggr(min([Date]),Prkcode,Number)),'all rows wrong',

Firstsortedvalue(User, -aggr(max([Date]),Prkcode,Number))

 

 

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
MJansen
Contributor
Contributor
Author

Hi Anil,

Thanks for your solution, seems logic what you are trying to do. 
Unfortunately, when I try this it gives me an 'invalid dimension', but at the bottom of the screen it says expression is 'OK'. 

Do you have another idea?

MJansen_0-1724138110180.png

 

Anil_Babu_Samineni

looks like the condition is valid but due to limitation in dimension for aggregated calculation, perhaps try this?

=Aggr(If((aggr(min({<[Accoord status]=,Actiestatus=,[Typecode]={'P'},[Statuscode]={'A'}>} [Date]),Prkcode,Number)<>aggr(min([Date]),Prkcode,Number)),'all rows wrong',

Firstsortedvalue(User, -aggr(max([Date]),Prkcode,Number)), Prkcode,Number)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
MJansen
Contributor
Contributor
Author

Thank you!