Converting to string and concat function

I have a "case" function (shown below), my goal is to add "+" or "-" to a number that will be calculated in the first summariez. My problem is that when i'm concatinating number and +/- , in the result i get + or - without number. I would like to solve this problem without doing SQL calculation.

image

is that in a custom column? Cause Custom Expressions should always have some type of aggregation, that Expression should fail

What result are you getting? Also what version are you running?

I'm writing this in Custom Expression, not column. Version: v1.49.18.
Result that I'm getting is just a sign "+". I'm wondering, does metabase convert to string type inside "question" panel? I tried to use substring function, and it fails to run.

I would expect that to fail actually since a custom expression in the summarise requires some kind of aggregate.

Why don't you simply multiply by -1 so you still have everything as numbers? A positive and a negative value

"-" sign is not a problem, but i want to see exactly "+" sign if my number is positive. Is there any solution for that?

Show me the whole GUI question you have created including the result ... you should use a concat but for me it doesn't make sense to use this in a custom expression ... but in a custom column after the result itself

Also when first summarize is not grouped, "custom column" will not appear.

You should have this one though? That is the custom column option:

and you can runt he case statement abouve

Yeah, i see that. But if I won't group by city_name and date, custom column disappears. I don't need groupping, but i need custom column after my first calculation. In a result I need to show only single indicator without groupping

Isn't this what you need:

Cause I think I am not getting your problem

yes, this but without groupping by date, on your example. Just 1 total indicator by whole period.

So do a sum save that value as a question and then use that question as a source to another question and add the custom column there

1 Like

ok, I'll try, thank you!

1 Like