Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
cmsjamesgreen
Contributor III
Contributor III

Set Analysis nested Max() not using Dimensions

I am using the following nested expression in set analysis to dynamically select a date period :

Max({<Transaction={'Last Known Stock Qty'}, Ledger={Actuals}>} Date)

Here is the full expression which I would like to return a bespoke date range for each dimension value:

Sum({<Transaction={Bill}, Ledger={Actuals}, Date={">$(=Max({<Transaction={'Last Known Stock Qty'}, Ledger={Actuals}>} Date)) <=$(=Max({<Transaction={Channel}, Ledger={Actuals}>} Date))"}>} [Billed Qty])

The expression delivers the correct date when used on its own and honours the dimensions, however when it is nested it seems to ignore the dimensions and returns the global Max() date.

Is this normal behaviour?  If it is, how do I get the nested expression to honour the dimension values.

 

Labels (3)
1 Reply
sunny_talwar


@cmsjamesgreen wrote:

Is this normal behaviour? 


Yes it is. Set analysis is evaluated once per chart and not per dimension. This is what makes set analysis perform better than if statement.

In your case, you can try to use Aggr() with if statement to accomplish what you are trying to do. Or you can also investigate FirstSortedValue() function