The reason seems to be that Qlikview ignors my dimensions in my chart (Dimension is Type) so that only(ValidFrom) and only(ValidTo) fails.
Once I get this to work, I also need to be able to select one or several months, or days in the report and it will calculate the values for that period which is also included in the range of valid dates.
So If I select November 2012, only values from November 2012 and from type B will be displayed, since type A and C are not within their valid date range.
Perhaps my explenation is not easy to understand, so I also made a attached example.
Hope someone can help me. It seems simple, but ...
Yes, I deleted my previous post which was about changing the datamodel as a optional solution request, since I realized that it will only solve the problem in my example - but in my real world actual data it will not be possible to change the datamodel, since I have not 3 types but 1000+ types, and one single transaction can belong to many types, so I came to the conclusion that solving this by changing the datamodel is not what I want, I need a solition with SET.
I look at your contribution in the test.qvw and as I understand, none of the set expressions give the same numbers as the IF expression. The "Foreced Type" way is probably in the right direction, but I don't understand why that example shows numbers for type a and C, it should only display numbers for B? However - the forced type solution will not be a approach for my "real data" since I can't write one expression for each type when I have thousands of Types.
("Types" are actually contracts in my real world data.
I will keep investigating for a solution. So lets keep posting here until we finally give up or finaly solve it! Thanks for your feedback!
If you check the Set analysis white paper, it clear says that the Set Expression is calculated only once per chart. Not for each dimension. So although you are referencing the "Type" as a dimension, the Set expression will not evaluate relevant values of only(ValidFrom) in the modifier clause for each row of Type. It will just find that out once per chart.