8 Replies Latest reply on May 2, 2018 11:36 PM by Sreenath Raveendran

# Calculated field for bar chart filter

Hello All,

Im new to tableau so could you please some advise a solution for the below scenario.

My datasource looks like below

SalesRep
ClientOrder Date
Sales
1A4/1/20185
1A4/2/201810
1A4/3/201810
1B4/6/20184
1B4/20/201820
1C4/15/201814
2D4/6/201860
2D4/14/201825
2D4/25/201810
2E4/10/201815
2F4/28/201810

On a sheet table, im showing the Sales Rep, Client name, their first order date, sum of sales and also have a filter added using first order date (Calculated).  First order date is calculated using the expression MIN(orderdate).

SalesRepClient
First Order Date
Sales
1A4/1/201825
1B4/6/201824
1C4/15/201814
2D4/6/201895
2E4/10/201815
2F4/28/201810

On another sheet, im displaying a bar chart with salesrep in rows and sum of sales in columns as below

Sales RepSum
163
2120

If i apply the filter, bar chart not displaying sale rep sum with in the condition. Suppose if i select first order date filter as 4/15/2018 then table filtered correctly but chart should display the sum of client sales whose first order date >= 4/15/2018. Seems chart taking first order date [min(orderdate)]  within the sales rep fields and not displaying anything. Im expecting the table and chart as below.

Table:-

Sales RepClientFirst Order DateSales
1C4/15/201814
2F4/28/201810

Chart :-

SalesRepSum
114
210

If i insert client field to rows shelf then it shows the chart but i need to draw the chart only for sales rep. Please advise.

First Order Date : MIN(orderDate)

First Order Date Filter :

IF([First Order Date] >= [First Order Date (Start)] AND

[First Order Date] <= [First Order Date (End)] )

THEN TRUE

ELSE FALSE

END

• ###### 1. Re: Calculated field for bar chart filter

Hi

Change your First Order Date calculation - to be fixed on Client and SalesRep

{ fixed [Client],[Sales Rep]: min([Order Date])}

Attached workbook in 10.5

J

• ###### 2. Re: Calculated field for bar chart filter

Thank you !

• ###### 3. Re: Calculated field for bar chart filter

Hi,

If i need to check order date from another source, is it possible to use FIXED.

IF(MIN([Order Date]) > MIN([Sales].[date]))

THEN MIN([Sales].[date])

ELSE IFNULL(MIN([Order Date]),MIN([Sales].[date]))

END

• ###### 4. Re: Calculated field for bar chart filter

HI Sreenath

You can blend your data sources and then build the Fixed LOD but it can get a tricky.

J

• ###### 5. Re: Calculated field for bar chart filter

Hi J,