Hi Philipp - I attempted to research this for you and could not get it to work either. I will submit to support for you so we can get more information.
I do not believe this works, because it's function is to return the current active group, which in this case (as defined in the Drill Down Dimension) may not be reference-able yet by this function.
any news about "GetCurrentField" usage in Sense ?
I'm stuck at same problem. In my case I'm using a pie chart, with a drill-down (let's say: A->B) dimension. If A gets down to just one possible value (due to other dimensions filtering), pie char automatically drills down to B but it seems there's no way to programmatically know that the currently showed dimension is B.
Thanks in advance.
Paulo , currently the getcurrentfield() isn't valid in Sense .
Would you be interested in a potential workaround ?
Its a little klugy instead of using getcurrentfield() i'm using a count(distinct total) to check how many field values are within my selection.
Say you have Country->City->Customer drill path and at the top level (when viewing countries) you want the pie to count the number of cities. When a user drills on one country and narrows the selection to just one country to see the cities within that country, then they want the measure to count the customers in each city.
Here is a conditional expression (think of it as long form version of getcurrentfield() ) to figure out which level of the hierarchy you are in.
In this example, the lowest level (customer) also shows the number of customers which doesn't make much sense but ... its just a quick example, you could add a nested IF to count ( distinct total city) = 1 and then display sum(SAles) or another metric at the lowest level.
Would this work for you ?
if (count( distinct total Country) > 1, Count(distinct City) , if ( count( distinct Country)=1 , Count(distinct Customer)))
Here is a 3 step drill visual of this in action:
I had the same problem... GetCurrentField not supported in Qlik Sense. So I found the following workaround:
So I would just use the variable you create within you aggr expression:
Hope it helps,