Is there a way to display a custom message if a determined condition is met?

Hello, community! This is my first interaction here.

I’m facing some doubts in regard to conditional messages in Looker. I don’t really know if that’s a thing, but here’s the problem:

  • I have a “Most Recent Survey” string-type dimension that labels Yes or No if the current visualizations are based on the most recent survey answers.​​​​​​;
  • I also have a measure “Total Respondents” that outputs the total number of collaborators that answered the survey;
  • There are teams that did not answer the last survey and thus receive no data if they filter the charts by their squad name;

I’d like to know if there’s anyway I can create a filter that if total respondents < 1, than a message like “No responses have been submitted for this survey round” prompts instead of Looker’s default message.

If something in this question isn’t clear, please let me know.

Thanks in advance!

Solved Solved
0 3 1,620
1 ACCEPTED SOLUTION

I believe that in this case, the best alternative would be to use conditional formatting with liquid on the HTML parameter.

Something like this:

dimension: responses_formatted {
sql: ${TABLE}.responses ;;
html: {% if value < 1 %}
" No responses "
{% else %}
{{ value }}
{% endif %}
;;
}

View solution in original post

3 REPLIES 3
Top Labels in this Space
Top Solution Authors