Roshan
Roshan

Reputation: 101

Dynamic Computation in Tableau based on User Input

I have a requirement to dynamically perform computations in Tableau based on User Input.

For this purpose my basic query looks something like this:

Select some_dimension,sum(some_measure)/count(some_measure) as 
some_measure_average
from table
where date = User_Input
group by some_dimension

The User_Input value should be passed based on what the user has selected and the corresponding computation should be performed based on the above query logic.Here , the Custom SQL should hit the connected Database that contains the data and display the computed data on Tableau.

Here the average is calculated based on the division of sum and count and should only be computed for the date value that has been selected.

The Custom SQL Query option in Tableau is not able to fulfill this requirement. Not sure if we are doing it correctly.

Upvotes: 0

Views: 1687

Answers (1)

Bernardo
Bernardo

Reputation: 3348

You can create a date parameter in Tableau and pass that as your User_Input. Type your query and click "Insert Parameter". Set the parameter Data type to Date and provide a current value. Insert it where needed in your query.

enter image description here

Upvotes: 2

Related Questions