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: 
Not applicable

error string combination

Hi there,

How can i combine the 2 expression together to achieve this outout:

V1 (7.6) Vs V2 (8.9)

=Subfield(GetFieldSelections([Vessel/Voy]),',',1)&'   Vs   '&''&sum({$<[Vessel/Voy]={'$(v1)'}>}PM_WAIT_TIME_Q) / Count ({$<[Vessel/Voy]={'$(v1)'}>}CNTR_N),''##,###.#'')

=Subfield(GetFieldSelections([Vessel/Voy]),',',1)&'   Vs   '&''&sum({$<[Vessel/Voy]={'$(v2)'}>}PM_WAIT_TIME_Q) / Count ({$<[Vessel/Voy]={'$(v2)'}>}CNTR_N),''##,###.#'')

Capture.PNG

Labels (1)
8 Replies
swuehl
Champion III
Champion III

You can use the concatenation operator & to concatenate two strings (and remove the second equal sign). Also check your quoting, I think the format code of the num() function should be embedded in single quotes only.

=Subfield(GetFieldSelections([Vessel/Voy]),',',1)&'   Vs   '&''&sum({$<[Vessel/Voy]={'$(v1)'}>}PM_WAIT_TIME_Q) / Count ({$<[Vessel/Voy]={'$(v1)'}>}CNTR_N),'##,###.#')

&

Subfield(GetFieldSelections([Vessel/Voy]),',',1)&'   Vs   '&''&sum({$<[Vessel/Voy]={'$(v2)'}>}PM_WAIT_TIME_Q) / Count ({$<[Vessel/Voy]={'$(v2)'}>}CNTR_N),'##,###.#')


edit:

Wait, where are the functions like num that used the format code at all. I've added num() functions.


=Subfield(GetFieldSelections([Vessel/Voy]),',',1)&'   Vs   '&''&Num(sum({$<[Vessel/Voy]={'$(v1)'}>}PM_WAIT_TIME_Q) / Count ({$<[Vessel/Voy]={'$(v1)'}>}CNTR_N),'##,###.#')

&

Subfield(GetFieldSelections([Vessel/Voy]),',',1)&'   Vs   '&''&Num(sum({$<[Vessel/Voy]={'$(v2)'}>}PM_WAIT_TIME_Q) / Count ({$<[Vessel/Voy]={'$(v2)'}>}CNTR_N),'##,###.#')

Anil_Babu_Samineni
MVP
MVP

What does the value you are getting for this, And can you provide the values of [Vessel/Voy]

SubField(GetFieldSelections([Vessel/Voy]),',',1) -- If This is V1


=Subfield(GetFieldSelections([Vessel/Voy]),',',1)& ' ' & '(' & Num(sum({$<[Vessel/Voy]={$(=Subfield(GetFieldSelections([Vessel/Voy]),',',1))}>} PM_WAIT_TIME_Q) / Count ({$<[Vessel/Voy]=>}CNTR_N),''##,###.#'') & ')' & ' ' & ' Vs ' &

Subfield(GetFieldSelections([Vessel/Voy]),',',1)& ' ' & '(' & Num(sum({$<[Vessel/Voy]=>} PM_WAIT_TIME_Q) / Count ({$<[Vessel/Voy]=>}CNTR_N),''##,###.#'') & ')'


Note: I didn't understand the $(v1) & $(v2)


OR


=Subfield(GetFieldSelections([Vessel/Voy]),',',1)& ' ' & '(' & Num(sum({$<[Vessel/Voy]={'$(v1)'}>} PM_WAIT_TIME_Q) / Count ({$<[Vessel/Voy]={'$(v1)'}>}CNTR_N),''##,###.#'') & ')' & ' ' & ' Vs ' &

Subfield(GetFieldSelections([Vessel/Voy]),',',1)& ' ' & '(' & Num(sum({$<[Vessel/Voy]={'$(v2)'}>} PM_WAIT_TIME_Q) / Count ({$<[Vessel/Voy]={'$(v2)'}>}CNTR_N),''##,###.#'') & ')'


Note: I've added NUM Function here

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
Not applicable
Author

Hi Anil

Pls see attached , doesnt work with the NUM function.

swuehl
Champion III
Champion III

The problem with the num() function is the incorrect quoting of the format code. use single quotes only:

=Subfield(GetFieldSelections([Vessel/Voy]),',',1)& ' ' & '(' & Num(sum({$<[Vessel/Voy]={'$(v1)'}>} PM_WAIT_TIME_Q) / Count ({$<[Vessel/Voy]={'$(v1)'}>}CNTR_N),'##,###.#') & ')' & ' ' & ' Vs ' &

Subfield(GetFieldSelections([Vessel/Voy]),',',1)& ' ' & '(' & Num(sum({$<[Vessel/Voy]={'$(v2)'}>} PM_WAIT_TIME_Q) / Count ({$<[Vessel/Voy]={'$(v2)'}>}CNTR_N),'##,###.#') & ')'

Not applicable
Author

Thanks but the missing num in v2 ()

Capture.PNG

Frank_Hartmann
Master II
Master II

try this:

Subfield(GetFieldSelections([Vessel/Voy]),',',1)& ' ' & '(' & Num(sum({$<[Vessel/Voy]={'$(v1)'}>} PM_WAIT_TIME_Q) /

Count ({$<[Vessel/Voy]={'$(v1)'}>}CNTR_N),'##,###.#') & ')' & ' ' & ' Vs ' &

Subfield(GetFieldSelections([Vessel/Voy]),',',2)& ' ' & '(' & Num(sum(aggr(sum(PM_WAIT_TIME_Q) /

Count (CNTR_N),[Vessel/Voy]))-sum(aggr(sum({$<[Vessel/Voy]={'$(v1)'}>}PM_WAIT_TIME_Q) /

Count ({$<[Vessel/Voy]={'$(v1)'}>}CNTR_N),[Vessel/Voy])),'##,###.#') & ')'

hope this helps!

Not applicable
Author

superb 😃

Frank_Hartmann
Master II
Master II

Im glad that it works 🙂

Please close the thread by marking correct answer. It will help others (who browse for the similar problem) to find the solution.