Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Get the Max per Row and its Date

Hello,

I have the following table:

IDXKXTDYKYTDZKZTD
1000,1218/09/2013 17:280,2510/09/2013 13:250,0828/09/2013 22:10
1000,2318/10/2013 17:351,3827/10/2013 7:530,1712/10/2013 1:38
1000,2219/11/2013 17:180,2005/11/2013 7:390,1017/11/2013 18:17

Where:

  • ID: Identifier
  • XD/YK/ZK: Power
  • XTD/YTD/ZTD: Time (HH:MM) and Date (DD/MM/YYYY) for the related Power.

So XK is related to XTD, YK is related to YTD and ZK is related to ZTD.

What I need is to get the max value between XK, YK and ZK for each row and also return the date for the corresponding Power.

In this example I should get:

IDMAXDATE
1000,2510/09/2013 13:25
1001,3827/10/2013 7:53
1000,2219/11/2013 17:18

Do you know how could I do this?

I'd prefer doing this in the script.

Thank you!

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Load RowNo() as NO, * Inline

[

  ID, XK, XTD, YK, YTD, ZK, ZTD

  100, 0.12, 18/09/2013 17:28, 0.25, 10/09/2013 13:25, 0.08, 28/09/2013 22:10

  100, 0.23, 18/10/2013 17:35, 1.38, 27/10/2013 7:53, 0.17, 12/10/2013 1:38

  100, 0.22, 19/11/2013 17:18, 0.20, 05/11/2013 7:39, 0.10, 17/11/2013 18:17

];

Create a Straight Table


Dimension

NO
ID

Expressions

1)

RangeMax(XK,YK,ZK)

2)

IF(RangeMax(XK,YK,ZK) = XK, XTD,

  IF(RangeMax(XK,YK,ZK) = YK, YTD, ZTD))

Go to presentation tab and select NO and Hide this column

View solution in original post

2 Replies
MK_QSL
MVP
MVP

Load RowNo() as NO, * Inline

[

  ID, XK, XTD, YK, YTD, ZK, ZTD

  100, 0.12, 18/09/2013 17:28, 0.25, 10/09/2013 13:25, 0.08, 28/09/2013 22:10

  100, 0.23, 18/10/2013 17:35, 1.38, 27/10/2013 7:53, 0.17, 12/10/2013 1:38

  100, 0.22, 19/11/2013 17:18, 0.20, 05/11/2013 7:39, 0.10, 17/11/2013 18:17

];

Create a Straight Table


Dimension

NO
ID

Expressions

1)

RangeMax(XK,YK,ZK)

2)

IF(RangeMax(XK,YK,ZK) = XK, XTD,

  IF(RangeMax(XK,YK,ZK) = YK, YTD, ZTD))

Go to presentation tab and select NO and Hide this column

Not applicable
Author

Great! Thank you very much!