Tableau: Switching worksheet - tableau-api

I have a tableau report that has a "Style" parameter that controls which worksheet to view. For example, if the Style="Chart" it will display the Chart worksheet, and if the Style="Summary" it will display the summary worksheet. I got this feature working as a charm. What if I want to add another dropdown data to the Style parameter "Both" that will display both "Chart" & "Summary". Is this possible? Can anyone provide me insights on how to accomplish this in tableau?

If you filtered your worksheets by the Style parameter, you could instead filter with a formula condition. Go to the Condition tab in the filter, and select By Formula. Something like this may work for your Chart worksheet:
[Style] = 'Both' OR [Style] = 'Chart'
If you used something other than filters to select the appropriate worksheet, please either explain how you're doing it or share a tdx.

Related

Tableau: Dashboard Parameter

I change my start date and end date parameter to a relevant date range, and I was able to switch the filters in the worksheet. How do I change the parameter in the dashboard? I was able to remove the start and end date parameter from the dashboard, but unable to add the new relevant date parameter in the dashboard.
You should be able to use Analysis -> Parameters option in the Main menu. This should show all the Parameters present in the worksheet on your dashboard. If it is not visible then make sure that you have the correct worksheet on your dashboard and the Parameter is enabled for filtering in the sheet present on your dashboard. Hope this helps.
There are 2 ways to add Parameter to your Dashboard
1) Select Analysis (on bar menu) -> Parameters ->
2) Right-click on any of the Sheet shown in your Dashboard -> Parameters ->

Visualization Tableau - Remove an option from a filter

This is the link of my visualization: My dashboard
In the tab "Cursos por ciclo", I would like to know how to remove the option "PTJE.TOTAL" from the filter "CURSO".
You can do this by creating a new calculated field.
Right click on CURSO and select "create calculated field" then use this formula:
IF left([CURSO], 4) <> "PTJE" THEN [CURSO] END
Basically, this means: if the value does not start with "PTJE" then include it.
Then use the new calculated field as a filter, you will see that it does not include the "PTJE. TOTAL" value (it has been replaced with nulls now). So when you apply a quick filter the "PTJE. TOTAL" value won't appear.
Note: Normally I'd use something simpler like:
IF [CURSO] <> "PTJE. TOTAL" THEN [CURSO] END
but that is not working with your data for some reason.
Also, you can read more about calculated fields in Tableau here:
http://onlinehelp.tableausoftware.com/v6.1/public/online/en-us/i181523.html

Return different datatypes crystal formula

I have a requirement where depending on the parameter selected the table field should be displayed as text or date. For eg, if the user selects a true, the OriginDate field which is a datetime type should be displayed as a date in the report else should be displayed as a text. I tried creating a formula an doing something like below, and then placing the formula in the details section of the report but it doesnt work due to different datatypes returned.
if {?Mailmerge}=true then
ToText({Travel.OriginDatetime}, "M/d/yy")
else
{Travel.OriginDatetime}
Is there a way I can accompalish the above requirement so that I do not end up creating 2 reports one with field displayed as text and other as date?
Try creating a formula that returns your field as a string totext({Travel.OriginDateTime},"M/d/yy") and overlay it with the original field {Travel.OriginDateTime} and conditionally suppress them based on the value of {?MailMerge} such that only one shows in any one instance of the report.
If I'm following you, you want to only show M/d/yy when ?MailMerge is true, otherwise yuo want to show the full date?
You can't show different datatypes in the same formula, so just convert them both parts of the conditional statement into strings:
if {?Mailmerge}=true then
ToText({Travel.OriginDatetime}, "M/d/yy") // 8/30/12
else
ToText({Travel.OriginDatetime}, "M/d/yy hh:mm:ss") // 8/30/12 02:06:00
I don't know what exactly your dates look like in the database, but you can use the above as a guideline into formatting your date based on the ?MailMerge parameter.

Programmatically show link to another report in Report Builder 3.0?

I have a grouping in my report that I want to use to link to another report. My dilemma is that I only want the link to be clickable when the value in the cell fulfills a certain criteria (number > x for example). If the condition isn't true, then I don't want the cell to be clickable. Is there a way to do this?
Edit: I've tried to set an IIF statement as part of the url, but what do I link to in the "false-part" of the statement? Using "" actually just refreshes the report, which isn't really what I want either. It also complains when I tried about:blank saying the url must start with http:// etc.
Use Nothing keyword in iif expression as false part. If Nothing is specified for Action than no link will be created.
=iif(YOUR_CONDITION, "Other Report", Nothing)
An action isn't dynamic so there's no way to turn it on and off based on a condition. But the expression you use to open another report can use an expression - whether you are using jump to report or the jump to URL action. One thing you might consider is for the condition when you don't want to jump to the other report is to jump to the same report. That is, let's say you are on Report A and you want to jump to Report B only when number > x. Then you use the expression:
=iif(number > x, "Report B", "Report A")
Report A will be cached so the net effect is that you didn't click even though the user can see the cursor change to a hand and can in fact execute a click.

Crystal Reports query help if-then-else

Basically I have a field in my table called sex, and it's a boolean. true for male, false for female. How can I display it this way instead of as 0, 1?
You want to create a formula field and add the formula field to the report instead of the sex field. Something like this should work (my syntax may be slightly off)
if {MyTable.sex} = 1
then
"male"
else
"female"
If you are unfamiliar with formula fields they are just expressions you can use and display in the report. In the 'Field Explorer' side bar in Crystal Reports you can see list of all the Database Fields etc. Just right click on the Formula Fields and add a new one. After you create the formula field you drag it onto your report layout just like any other normal field.
Use a formula field. Put, say, #Sex into your report, then edit it to be something like:
//may need tweaked....
If {database.table.sex} then
male
else
female;
My Crystal formula syntax is really rusty, so that may not be right as written. It might need to be :
//may need tweaked....
Stringvar displaySex;
If {database.table.sex} then
displaySex = "male"
else
displaySex = "female";
displaySex
And the line-end (";") format might not be right....
If you right-click on the original database field and choose "Format Field...", you can set the Display String on the Common tab using one of the formulas above, instead of creating a separate formula to do the calculation.