Skip to main content

I am trying to create a dynamic drop down for case count and percentage case count but if in KPI formating i select percentage with 2 decimal then my count also coming with percenatge sign while i want to set case count with round no .

how can i create dynamic formating?

I don't think there is a way to dynamically set the formatting field.

What you could do instead is outputting the numbers in the desired format in the first place, even when this means you convert them first to a string.

 

I.E.:

For each entry in a use Button-Dropdown a different PQL is stored in a VARIABLE. Here it is called 'MY_KPI'.

This variable goes into the PQL editor field:

Editor 

For a normal number (i.E. from a COUNT_TABLE() statement) the result can be displayed without any changes. Just write the PQL into the variable:

Count 

For a percentage representation you can multiply the result by 100, round it to x decimal places and concatinate a '%' character by using the '||' operator: If your KPI value was i.e. 0.0573 you would get:

 

Multiply by 100: 0.0573 * 100 -> 5.73

Round to 1 decimal: ROUND(0.0573 * 100, 1) = -> 5.7

Add '%' character: ROUND(0.0573 * 100, 1) || ' %' -> 5.7 %

 

This looks something like this:

Ratio 

I wanted to see decimal and thousand seperators so for the field "predefined formats" I chose "Custom Formula" with 0 decimal places. That gives me seperators for normal numbers and the percentage representation is just a custoim built string anyway.

 

BR Florian


I don't think there is a way to dynamically set the formatting field.

What you could do instead is outputting the numbers in the desired format in the first place, even when this means you convert them first to a string.

 

I.E.:

For each entry in a use Button-Dropdown a different PQL is stored in a VARIABLE. Here it is called 'MY_KPI'.

This variable goes into the PQL editor field:

Editor 

For a normal number (i.E. from a COUNT_TABLE() statement) the result can be displayed without any changes. Just write the PQL into the variable:

Count 

For a percentage representation you can multiply the result by 100, round it to x decimal places and concatinate a '%' character by using the '||' operator: If your KPI value was i.e. 0.0573 you would get:

 

Multiply by 100: 0.0573 * 100 -> 5.73

Round to 1 decimal: ROUND(0.0573 * 100, 1) = -> 5.7

Add '%' character: ROUND(0.0573 * 100, 1) || ' %' -> 5.7 %

 

This looks something like this:

Ratio 

I wanted to see decimal and thousand seperators so for the field "predefined formats" I chose "Custom Formula" with 0 decimal places. That gives me seperators for normal numbers and the percentage representation is just a custoim built string anyway.

 

BR Florian

Thanks, It makes sense .

Reply