Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
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

8 Replies
MVP
MVP

Re: error string combination

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),'##,###.#')

Re: error string combination

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

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Not applicable

Re: error string combination

Hi Anil

Pls see attached , doesnt work with the NUM function.

MVP
MVP

Re: error string combination

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

Re: error string combination

Thanks but the missing num in v2 ()

Capture.PNG

Frank_Hartmann
Honored Contributor II

Re: error string combination

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

Re: error string combination

superb 😃

Frank_Hartmann
Honored Contributor II

Re: error string combination

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.