0
votes

I have a problem that I can't really solve with my logic. I want to get all Customers from a certain city that made an order from the same city on a certain date range and made the order from the same city at any Date before this certain Date range.

I tried to do it with Fixed:

My solution I tried was to Create 3 Parameters, one that holds the Certain Order_Date called "Certain_Date", one that Hold the End Date of a Date Range I want to see called "End_Date" and one that holds the Name of the city "Certain_City".

Here my Calculation field:

IF { FIXED [Customerid], [Certain_City] : MIN(Order_Date) < [Certain_Date] }
AND { FIXED [Customerid], [Certain_City] : MAX(Order_Date) >= [Certain_Date]}
THEN "Customer Ordered from City before"
ELSE "Customers first Order from this City"
END

This Calculated field does not work, it only gets me the Customers that made an order from any City before.

Also I used a Filter to show only the CustomerID-s that ordered from the Certain_Date to the End_Date. But it won't work, any Ideas?

Here An Example what I want:

>     Order_Date Customer_ID City
>     01.10.2016 1234        Stockhom
>     01.05.2016 1234        Stockhom
>     01.03.2016 1234        Oslo
>     05.10.2016 1455        Berlin
>     01.04.2016 1455        Berlin
>     02.10.2016 1211        Stockhom
>     06.03.2016 1211        Prague

Let say the "Certain_Date" is 01.10.2016 and the "End_Date" is 03.10.2016

From this Data I want to create a Barchart that holds the Number of Unique CustomerID-s, and that colors the "Customer Ordered from City before" and the "Customers first Order from this City".

In this Example the Barchart would go up to 3 Elemnts. Where the CostumerID-s 1234 and 1455 would be colored Blue because they ordered from the same City before, and 1211 would be colored Red because it ordered before the Date but not from the same City.

2
Could you give us a small sample data set and your expected results form it?lampbob
I just update it with an exampleVedad
In your calculated field. Should the second line use the "end_date" calc field and not the "certain_date"?lampbob
No it is fine like it is, i will use the End_Date later for some filtering i just want to know if the Customer buyed befor in the sam cityVedad

2 Answers

0
votes

Try This

Create 3 parameter

  1. Start Date

  2. End Date

  3. City

Now

Create a Calculated Field C1

 {fixed [Customer],[OrderCity]:max(if OrderDate>=StartDate and OrderDate<=EndDate then 1 end)}

Create Another Calculated Field C2

 If C1>=1 and orderDate<StartDate then 'true' else 'False' end

Put This C2 in Filter Set Default value=True

Tell me did it worked?

0
votes

maybe you could build a calculated field that brings client and city together as client_city