0
votes

Tableau Issue

I have a column which is named as type and has the following fields a b c d e
along with a date column and customer id column
Now for every date there is unique customer id who is giving orders
ex 25th june we have customer id say xxx ordering for type a b c 26th june we have 2 different customer id say yyy and zzz for type b d e and 27th June customer xxx (who also ordered on 25th june) order for b on june 27

Condition

Once a customer id is tagged in a source it should be kept in the same source for the entire month depending on the first order date. Like 25th June a same customer has ordered for a b c and same customer on 27th june for b it should be tagged in a only depending on first order date.

Result

I want to get the source wise count of customers in tableau.

Date Type a Type b Type c Type d
25th June 1
26th June 2

25th june xxx customer 26th June yyy and zzz customer hence 2. 27th June xxx ordered but since he is already counted on 25th and also he is tagged on a then for 27th i dont want to have any row.

I have created a separate calculated field but it doesn't work.

Any help would be appeciated

1

1 Answers

0
votes

Create two calculations

[user first order over month date]

{FIXED DATETRUNC('month', date), user_id : min(date)}

[user first order over month type]

{FIXED [date], user_id : MIN(IIF([date] = [user first order over month date], [type], NULL))}

Now place 1st one on rows, 2nd on columns and count(distinct user_id) on text (marks shelf)