is there a way to calculate the max of a String, based on his alphabetic order?
In a table functions we can insert the string field inside the brackets, eg. [{string dimension} ASC]. I would like to have the same but with a function, actually I cannot use Max function with a string.
Thank you but this cannot work for me, I would like to have the output of “lastvalue” function without inserting in the visual, the field used in the function. The lastValue function, requires the original field to be inserted in the visual.
To achieve this, I transformed the text field in numeric, then calculate the max, then reconvert it into the previous format. This isn’t efficient at all, above all with millions of rows…
@Andrea - Another approach. You can change the calculation level argument to PRE_AGG for the Rank function. Then you can use the calculated field in your other calculated fields without having the dimension in your field wells.
You can change the partition field in the rank according to your use case. For this example I’m showing the last alphabetical customer’s total sales by region.
Hi @robdhondt , I appreciated the workaround but this won’t work for my case since the “Yes” and “No” classification will split the data (as you see in your sales column). I just want the max of a string to use it as a static value, so put into a calculated field, in a if-else condition.
Thanks
@Andrea – That’s just how I used it in the example. You don’t need to use it that way. Not knowing what your use case is, here is an example to return only the last alphanumeric customer’s sales.
Hi @robhondt, I would like this but without that NULL. So having the last_alphabetical customer_name repeated for all the fields (in case calculated in the dataset) or aggregated to be a constant (in case calculated in the analysis).
I didn’t try, I will let you know once done but first impression is that it won’t work.
@Andrea - Yeah this is a stubborn one. One last way you could achieve this, but it requires creating a calculated field for each value in your viz. You’d have to see how that stacks up against your costly transformation workaround.