Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I need to compare the number of orders for the selected and previous year, based on an OrderDate (e.g. 1-1-2018 = year 2018) as I have no OrderYear field.
I have created the following variables:
vSelectedOrderYear = GetFieldSelections(Year(OrderDate))
vPreviousOrderYear = GetFieldSelections(Year(OrderDate)-1)
And the following expressions:
Selected year=count({<OrderDate={$(vSelectedOrderYear)}>} distinct (Orderkey))
Previous year=count({<OrderDate={$(vPreviousOrderYear)}>} distinct (Orderkey))
However result is 0.
I also tried to create the OrderYear via the script:
Year(OrderDate) as OrderYear
and with the expression:
Selected year=count({<[OrderYear]={'$(=OrderYear)'}>} DISTINCT[OrderKey])
Previous year=count({<[OrderYear]={'$(=Year(OrderYear)-1)'}>} DISTINCT[OrderKey])
Then I have the correct result for the selected year but no results for the previous years.
Can you please help me? Thanks in advance.
Regards,
Marielle
Try this for previous year
Previous year =Count({<[OrderYear]={'$(=Max(OrderYear)-1)'}>} DISTINCT[OrderKey])
Unfortunately, then the count for both years is equal:
Would you be able to share a sample to show the issue?