Skip to main content
Announcements
Qlik Community Office Hours, March 20th. Former Talend Community users, ask your questions live. SIGN UP
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Subtracting from FirstSortedValue

Hi,

Thanks to the forum I been given the following expression to use on text_object:

=if(status = 16, FirstSortedValue(updatetxt_test, -udindex_test), FirstSortedValue(updatetxt_test, -udindex_test))

status 16 = Close Calls

status 15 = Resolved Calls

updatetxt_test = Call Text

udindex_test - Unique value of call text

Example Data:

Callref    udindex  updatetxt                                   status

221312   0           User requires New Account         16

221312   1           User account created                  16

221312   2           Closed by System Administrator  16

221313   0           User requires Office Install           15

221313   1           Office 2010 installed on machine  15

The issue I have is that when a call is closed the last call text always shows as 'Closed by System Administrator' where as when the call is Resolved the last call text shows the resolution text.

Is it possible to amend the above expression so that when the status = 16 the max udindex is taken away by 1, therefore as in the example above callref 221312 will show udindex field 1 instead of udindex field 2?

Regards,

Jon Ditchfield

1 Solution

Accepted Solutions
Not applicable
Author

Hi Jon, In the FirstsortedValue there is one optional parameter Sort Weight.

Try Like below:

if(status = 16, FirstSortedValue(updatetxt_test, -udindex_test,2), FirstSortedValue(updatetxt_test, -udindex_test))

View solution in original post

2 Replies
giakoum
Partner - Master II
Partner - Master II

=if(status = 16, FirstSortedValue(updatetxt_test, -udindex_test),

                       FirstSortedValue(updatetxt_test, -udindex_test)

)

It looks like your true and false parts of the if statement are exactly the same. Is this working as expected?

Anyway, -1 would do it I guess :

=if(status = 16, FirstSortedValue(updatetxt_test, -udindex_test) - 1,

                       FirstSortedValue(updatetxt_test, -udindex_test)

)


Not applicable
Author

Hi Jon, In the FirstsortedValue there is one optional parameter Sort Weight.

Try Like below:

if(status = 16, FirstSortedValue(updatetxt_test, -udindex_test,2), FirstSortedValue(updatetxt_test, -udindex_test))