4 Replies Latest reply: Nov 10, 2015 11:34 AM by Sunny Talwar

# count differently if different date

Hiya

I wish to on a chart, on after a certain date, count different conditions

I have the following expression

e.g

if(OrderDate < '01/01/2015', count({\$<  DeliveryType = {"1"}CustomerID)) or

if(OrderDate > '01/01/2015', count({\$<  DeliveryType = {"2"}, CustomerID))

I am having no joy

• ###### Re: count differently if different date

May be this:

Count({<OrderDate = {"\$(='<' & MakeDate(2015, 1, 1))"}, DeliveryType = {1}> + <OrderDate = {"\$(='>' & MakeDate(2015, 1, 1))"}, DeliveryType = {2}>}CustomerID)

Count({<OrderDate = {"\$(='<' & Date(MakeDate(2015, 1, 1), 'YourDateFieldFormat'))"}, DeliveryType = {1}> + <OrderDate = {"\$(='>' & MakeDate(2015, 1, 1), 'YourDateFieldFormat'))"}, DeliveryType = {2}>}CustomerID)

Note:
You have < (less than) and > (greater than), but not equal. I would expect data for OrderDate = 1/1/2015 so add = sign to one of the two expressions.

• ###### Re: count differently if different date

Hi Joanna, the syntax for set analisys is incomplete:

if(OrderDate < '01/01/2015', count({\$<  DeliveryType = {"1"}>} CustomerID)) or

if(OrderDate > '01/01/2015', count({\$<  DeliveryType = {"2"}>} CustomerID))

It can work depending of your dimension, if it's OrderDate it can work, if it's some field wich can have many OrderDate (like months o weeks) you'll need to add an aggregation funtion to OrderDate to pick only one of those values:

If(Max(OrderDate) ....

• ###### Re: count differently if different date

Hiya

Sunny ...your version works best but only if I select  a OrderDate from the filter pane,