please could you help me to understand why your solution does not work?
Actually I found that my solution works if the dimensions are fixed in the table, however in my real production table I have a table where the dimensions are mobile (I have a filter and I can select which dimension to show and which dimension to hide).
so in that case my solution does not work, but your solution could work as it is dimensions-indipendent.
Hope I have explain the problem, but ask me if something it is not clear, thanks for your help in any case.
I attach a qvw file, so you can see by yourself if I applied your solution in the right way.
tipo-record.qvw 151.8 K
I think it is working correctly, at least in the way I understood your question. In your example qvd:
2006/01 has for 'C' a value of 330 and for 'P' a value of 278. The expression returns 330.
2006/05 has a value of 847 for 'C', The expression returns 847.
2009/06 has a value of 284 for 'P' and no value for 'C'. The expression returns 284.
Perhaps you confused things by leaving [tipo record] as a dimension? Or else I have not correctly understood your requirement.