Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi,
I am trying to create a pivot table with a measure called 'actual', but this is the result at the moment, where the sum is not visible.
I specify that the key is the field COMMESSA (in this case equal to "TE22415"),and the sub-category is called "MACRO TIPO COSTO" (1 Ricavi,3 personale ecc.....) and inside we find another dimension called 'TIPO COSTO ricavi,dipendenti,ecc).
This the script for the measure ACTUAL (sorry if is so complex):
You have a number of naked field references in your measure (field references that are not inside an aggregation function). These will evaluate to NULL on the totals rows.
See more on https://community.qlik.com/t5/Design/Use-Aggregation-Functions/ba-p/1475833
Hi,
The formula is overly complex indeed. I'd recommend to look for creative ways of simplifying the logic, perhaps by improved data modeling and by using associative logic, - associating some numeric factors with various categories of data, to eliminate so many IF questions etc. If your data set is large, it will likely to be very slow.
However, the specific issue is quite easy to see - you are using "naked" field names in your IF conditions and in the calculations. These fields have unique values at the detailed level, and the formula is working. At the total level, the same fields have multiple values, and hence the condition cannot be verified and the calculation cannot be completed.
To fix it, enclose your calculation in the AGGR() function and use all of your chart dimensions as the AGGR() dimensions - this way, your "naked" fields will still have unique values within the AGGR(). For example:
sum(AGGR( <your whole formula>, Dim1, Dim2, Dim3))
This formula should work at the total level.
Cheers,