Displaying Numbers and Percentages in the Same Column

Hello Looker Community,

I’m currently working on a report and I’ve encountered a challenge that I hope someone could help me with. I have a requirement where I need to conditionally format a single column as either a number or a percentage based on the corresponding “Type” value.

Specifically, if the “Type” value indicates ‘Percentage’, then the corresponding value in my target column should be formatted and displayed as a percentage. Conversely, if the “Type” value indicates ‘Number’, the corresponding value in the target column should be displayed as a regular number.

I’m struggling to find an approach to achieve this in Looker. Is there a way to conditionally format a field in Looker to display as either a number or a percentage, based on the value of a different field?

Any suggestions, insights, or guidance on this would be greatly appreciated.

Thank you in advance!

Hi,

Check if a table calculation helps. Call this expression> if(YesNo, Any, Any).

It should look like> if( Type = ‘Percentage’, concat(your_value, ’ %') ,your_ value)