Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I've only just started using the software, so apologies if this should be simple, I'm looking for a bit of assistance...
I have a couple of expressions that are working fine:
sum(if($(vShowQty)=1,QtyInvoiced,NetSalesValue))
and
sum({$ <[Sales.Year]={"2010/11"}>} NetSalesValue)
The variable vShowQty is set based on two buttons and could either equal a 1 or 0. Ideally, what I'm trying to do is combine the above two expressions into a single expression. Essentially if vShowQty=1 and Sales.Year ="2010/11" I want to sum the QtyInvoiced, otherwise if vShowQty=0 and Sales.Year="2010/11" I would want to sum the NetSalesValue.
Not sure if the above makes complete sense, but hopefully someone might be able to point me in the right direction?
Thanks
Maybe like this
=if( vShowQty = 1,
sum({$ <[Sales.Year]={"2010/11"}>} QtyInvoiced),
sum({$ <[Sales.Year]={"2010/11"}>} NetSalesValue)
)
Since vShowQty is a variable you don't need to check it per record (i.e. inside the aggregation), and you probably don't need the dollar sign expansion $(..) when used in a chart expression.
Note that {$ <[Sales.Year]={"2010/11"}>} is assigning value 2010/11 in a set expression's field selection, it's not really a condition as one can understand your above written requirement (if vShowQty=1 and Sales.Year = 2010/11 ...)