How to concatenate multiple values in single KPI?

Hi Folks,

I have multiple expressions. Expression1 getting value of 78 and Expression2 is a percentage. Its value is 9.5%. I want to show both the values in a single KPI. KPI should show the value as follow

78(9.5%)

How to Implement this. Could someone please help to fix this?

Thanks,
Satya

1 Like

Hi @SatyaPaleti , hope this message finds you well!! Welcome to community :smiley:

I did some similar once.
Assuming Expression1 and Expression2 are the names of your fields, you can create a calculated field that would be something like:
concat(toString({Expression1}), '(', toString({Expression2}), '%)')
Once the calculated field is created, you can use it in your KPI visual. Drag the new calculated field to the KPI visual to display the formatted value as desired. This should enable you to display the value in the format “78(9.5%)” in a single KPI in qs.

please, tell me if it’s work

1 Like

Hi Lary,

Thank you so much for your response. But it’s not working :unamused:

Thanks,
Satya

@SatyaPaleti

Have you tried to put this result in another visualization to see if it’s working?
qs show you some specific error?
can you show me more details about your calculated fields and how is creating the kpi, please?

Yes I tried to put this result in another visualization, below is the expression I am using

Expression 1 : distinct_count({Participant ID})
Expression 2 : distinct_count({Participant ID})/distinct_count({Study ID})

concat(toString(distinct_count({Participant ID})), ‘(’, toString(distinct_count({Participant ID})/distinct_count({Study ID})), ‘%)’)

Can you try something like:
Expression1 = distinct_count({Participant ID})
Expression2 = (distinct_count({Participant ID}) / distinct_count({Study ID})) * 100
and then create a combined calculated field:
CombinedExpression = concat(toString(Expression1), '(', toString(Expression2), '%)')

the error message “Unsupported aggregations” suggests that the way aggregations are being applied is not supported in the current context, but I think that this could help

I have tried the same expression what you have given but no luck

@SatyaPaleti,

If the second value doesn’t have to be on the same line, you can do this by overlapping visuals in free-form layout.

Create a KPI to show your first value and create an insight to show your second value. Then, position your insight on top of your KPI and make its background and border transparent.

I’ve done something like this before. If you place the 2 values on the same line, they might overlap sometimes depending on the length of each value. Your best bet is to display one below the other like this.

1 Like

Hi @SatyaPaleti,
It’s been awhile since we last heard from you, did you have any additional questions regarding your post or were you able to find a work around from one of the solutions provided above?

If we do not hear back within the next 3 business days, I’ll close out this topic.

Thank you!

Hi @SatyaPaleti,
Since we haven’t heard back, I’ll go ahead and close out this topic. However, if you have any additional questions, feel free to create a new post in the community and link this discussion for relevant information if needed.

Thank you!