Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
joeybird
Creator III
Creator III

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

please advise / help

4 Replies
sunny_talwar

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.

rubenmarin

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) ....

joeybird
Creator III
Creator III
Author

Hiya

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

please advise / help

sunny_talwar

Would you be able to share a sample?