Hi all,
A bit of a complex one - and completely understand if Tableau is not the product for it, but I have users requesting the ability to select two Products (A and B) and want metrics and graphs derived based on their selection.
Has anyone done something similar to this?
So if a user selects Product A and Product B, based on the data for each product, it will generate a table with a composition of characteristics comparing both, noting that some metrics use complex business logic.
I vaguely remember seeing a workbook shared here which used user parameters to write into an embedded SQL query which might be able to accomplish this? I thought I'd post here in case anyone had a better idea.
I have freedom transforming data to whatever structure is required to have this work - as well as access to a SQL database for storage / querying.
Hi,
I’m not sure whether this adds anything to @寛奈 阿藤 ’s detailed explanation above, but there is one point to keep in mind regarding how NULL values are handled when calculating the difference between Product A and Product B.
For example, if a missing value should be treated as zero, you can use ZN():
ZN([Product B Sales]) - ZN([Product A Sales])
If you don’t handle NULLs, the result of the subtraction will also become NULL whenever either side evaluates to NULL.
Of course, whether NULL should be converted to zero depends on the business meaning of the data, but it may be worth considering when using this approach.
ex)
// Difference
zn([Product B Sales]) - zn([Product A Sales])
or:
// B vs A %
IF [Product A Sales] <> 0 THEN
(zn([Product B Sales]) - zn([Product A Sales]))
/ [Product A Sales]
END