This has been asked a number of times and I fairly certain it exists as an idea however, this is not yet available.
I have also tried this, the biggest issue I found is that Tableau is unable to parse the sql due to there being no defined data-source as the parameter data-source value is not passed to the script until runtime
I have handled it by updating the workbook xml, like Steve says I have never seen a way to do it in desktop.
Coincidentally Steve posted a good explanation of how to do it
Thanks for your response
The functionality I am hoping to provide my end users is the ability to choose which environment to run a report against from a simple onscreen parameter / dropdown.
Evidently this is not possible without first combining all the data on a single server first ?
Thinking about it, there might just be a way to do this - I shall test when I am back in the office.
Using SQL, it is very possible to be able to define a datasource from a t-sql parameter something to the effect of:
Declare @Cn As Varchar, @ds SmallInt
Select @ds = IsNull(<Parameters.DataSource>,1)
If @ds = 1 Set @Cn = 'dbo.Table1'
ElseIf @ds = 2 Set @Cn = 'dbo.Table2'
During the parsing operation, the parameter will be nulled so the default value of 1 shall be assigned which shall provide a connection string.
This will work in ssms:
Declare @p SmallInt, @TabParam SmallInt Select @p = IsNull(@TabParam,1) If @p = 1 Goto stg Else If @p = 2 Goto dw stg: Select * From stg.Sales Return dw: Select * From dw.Sales Return
But frustratingly, changing the '@TabParam' to <Paramaters.Cn> unfortunately does not work.
As Tableau can query stored procs, this might just present a way around this by having Tableau pass in the parameters at run-time.