3 Replies Latest reply on Sep 13, 2018 4:41 AM by Artem Popov

# Dynamic calculation

Hello all

I'm very beginner in Tableau and maybe my question looks quite basic.

I've create simple table and set a filtering by 2 dimensions:

Now I need to calculate several new fields, but it every time it will depends by set of filters selected

For example: I will select Districts of County 2 and 4 then calculate: If average price within selection is bigger than 250 then NewValue = (Value Average - Value Malt) / Value Total *100 for each district

Selection of counties and districts is free and I need to calculate set of new values for each district and set of other ones for whole selection and display them as new table.

I'd be very appreciate for any help.

Sample file is attached.

• ###### 1. Re: Dynamic calculation

Hi,

Is that what you wanted?

Let us know if this help. Workbook attached for your reference.

Mahfooj

• ###### 2. Re: Dynamic calculation

Few changes in the calculation,

IF {AVG(IIF([Fact]="Price",[Value],NULL))}>250 THEN

({FIXED [County],[District]:SUM(IIF([Fact]="VAL Average",[Value],NULL))} - {FIXED [County],[District]:SUM(IIF([Fact]="Value Malt",[Value],NULL))})

/ {FIXED [County],[District]:SUM(IIF([Fact]="Value Total",[Value],NULL))}

END

Use above logic,

Note: Put your filters on context

• ###### 3. Re: Dynamic calculation

Hi Manfooj!