Show field only when 1 value is available/selected

Hi, I want to show a field value but only when 1 is available. I tried using this formula in a calculated dimension

ifelse(distinct_count({Rank})=1,{Rank}, ‘Please select a user’)

But I get a mismatched aggregation error. Does anyone have any suggestions on how to do this?

Thanks

Hello @wildcard440 Hope this message finds you well!

The error you’re encountering is due to mixing aggregated and non-aggregated fields in your ifelse statement. To resolve this, you need to ensure that all parts of the ifelse function are using consistent aggregation. Here’s a suggested approach:

Ensure that both the condition and the output of the ifelse function are using aggregated fields.
0R
You can use the max function to ensure consistent aggregation. Something like this:

ifelse(
    distinct_count({Rank}) = 1,
    max({Rank}),
    'Please select a user'
)

By using max({Rank}), you ensure that the formula is consistent in terms of aggregation, which should eliminate the error. If you continue to experience issues, consider reviewing the data to ensure that the Rank field is being used correctly in the context of your dataset.

Please let me know if it helps you

Hi Larry, thanks for your response. I did try using max however the field {Rank} is a string e.g. 15/100. is there a function like maxstring() or some other similar approach you can do in quicksight to achieve the same result?