-
1. Re: How can one choose to include or exclude data with certain condition on a calculated field?
Bryce Larsen May 16, 2018 3:15 PM (in response to Jose Salazar)Hi Jose,
You can drag the Product onto the Rows shelf and then drag Quantity there as well (should default to SUM).
Then you can either put Storage Location onto the Filters and make this a “Multiple Values” filter
OR
make a parameter titled Include/Exclude where you can then use in a calculated field:
If Exclude then Storage Location <> “Other” ELSE True END
Hope this helps! Sorry I can’t provide screenshots currently - commuting home! Happy to later.
-
2. Re: How can one choose to include or exclude data with certain condition on a calculated field?
Wesley Magee May 16, 2018 3:19 PM (in response to Jose Salazar)Jose,
Here's a quick calc you could use with a Parameter showing "Include" and "Exclude" as the options:
IF [Parameter 1] = "Include" THEN [Quantity]
ELSEIF [Parameter 1] = "Exclude" THEN (IF [Storage Location]!= "Other" THEN [Quantity] END)
END
-Wesley
If this post assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution. Thank you.
-
4. Re: How can one choose to include or exclude data with certain condition on a calculated field?
Dan CoryMay 16, 2018 3:20 PM (in response to Jose Salazar)
Create a Boolean parameter called [Include Other] and use a calculation something like the following:
IF [Storage Location]<>"Other" OR ([Storage Location]="Other" AND [Include Other]) THEN [Quantity] END
Just drag this calculation on to the shelf.
Dan
-
5. Re: How can one choose to include or exclude data with certain condition on a calculated field?
Jose Salazar May 17, 2018 1:47 PM (in response to Zhouyi Zhang)Hi, thanks for the help.
May you please provide me the formula?
I have tableau 10.1, and can't open your attachement.
-
6. Re: How can one choose to include or exclude data with certain condition on a calculated field?
Jose Salazar May 17, 2018 1:49 PM (in response to Bryce Larsen)Hi, sorry for my ignorance, but didn´t really get your point. May you please provide a screenshot?
-
8. Re: How can one choose to include or exclude data with certain condition on a calculated field?
Jose Salazar May 17, 2018 2:00 PM (in response to Wesley Magee)Hi, thanks.
It almost got me my solution.
The issue I faced with this one is, the "product" and "Quantity and Storage location", come from two different data source, so the quantity value is calculated as an aggregation.
When "include" is set, all works fine.
But, when "exclude", is set, some products show the correc quantity value, but the other quantity are shown as "null".
-
9. Re: How can one choose to include or exclude data with certain condition on a calculated field?
Jose Salazar May 17, 2018 2:10 PM (in response to Dan Cory)Hi,
I think the "OR", would make the calculation uncorrect, becuases it includes every "storage location"?
-
10. Re: How can one choose to include or exclude data with certain condition on a calculated field?
Jose Salazar May 17, 2018 2:20 PM (in response to Bryce Larsen)Option 1, should work, but I don´t want anyone being able to screw with the rest of storage locations.
Option 2, didn´t work. I think because. Product (Data source: Product List) and Quantity and Storage location (Data source: Stock List) come from two different data source, (Not Joined). So it does notthing to the calculation of "Total Quantity"
-
11. Re: How can one choose to include or exclude data with certain condition on a calculated field?
Bryce Larsen May 17, 2018 2:26 PM (in response to Jose Salazar)Do you have a workbook? Works fine in one data source - didn't know you were doing a blend.
-
12. Re: How can one choose to include or exclude data with certain condition on a calculated field?
Jose Salazar May 17, 2018 2:52 PM (in response to Bryce Larsen)My bad.... sorry!
Attached are examples of each data source, representing the nature of the ones I'm using.
The product column should come from "Product List"
-
Storage List Example.xlsx 8.5 KB
-
Product List Example.xlsx 8.3 KB
-
-
13. Re: How can one choose to include or exclude data with certain condition on a calculated field?
Bryce Larsen May 17, 2018 3:20 PM (in response to Jose Salazar)1 of 1 people found this helpfulHi Jose Salazar,
I understand now. So, even if product doesn't have data in the storage table, you want to see it.
You are correct - you'll encounter issues when doing a blend then. Is there a reason you can't join datasets prior to bringing them in?
Doing this should help you get the final view you're aiming for:
New fields:
CF_FilterStorage:
IF [PA_ExcludeOther]
THEN [Storage Location]<>"Other" OR ISNULL([Storage Location])
ELSE TRUE
END
CF_StorageDisplay (done to show blank string rather than writing Null):
IFNULL([Storage Location], "")
CF_Quantity (done to show 0 instead of empty cell):
ZN([Quantity])
Hope this helps!