Can anyone give a high-level overview of how I can...
# suiteanalytics
f
Can anyone give a high-level overview of how I can create a SuiteAnalytics workbook that can show me: • All items • For each item, groupings under it that show the most "frequently bought together" items I'm having a hard time wrapping my head around what joins are supposed to happen. Is it possible to replicate a SuiteQL query into a dataset?
watching following 2
w
AFAIK, it is not possible to convert a Suiteql into a dataset. It might be possible to recreate it. But it depends on the complexity of the SuiteQL. Regarding your query. Is the "most frequently bought together" available somewhere? (Except for the transactions)
f
@Watz we had to do a pretty complicated query to get this data. Here it is:
Copy code
SELECT
    hello.numerator,
    COUNT(DISTINCT t.otherrefnum) AS denominator,
    ROUND((hello.numerator / COUNT(DISTINCT t.otherrefnum))*100,2) AS bundle_pge,
    i.itemid,
    hello.t2_sku
FROM transaction t
INNER JOIN transactionline tl ON tl.transaction = t.id
INNER JOIN item i ON tl.item = i.id
INNER JOIN (
    SELECT
        COUNT(DISTINCT t1.otherrefnum) AS numerator,
        i1.itemid AS t1_sku,
        i2.itemid AS t2_sku
    FROM transaction t1
    INNER JOIN transactionline tl1 ON tl1.transaction = t1.id
    INNER JOIN item i1 ON tl1.item = i1.id
    INNER JOIN transactionline tl2 ON tl1.transaction = tl2.transaction AND tl1.item<> tl2.item
    INNER JOIN item i2 ON tl2.item = i2.id
    WHERE (t1.recordtype IN ('cashsale', 'salesorder'))
      AND tl1.quantity > 0
      AND tl2.quantity > 0
    GROUP BY i1.itemid, i2.itemid
    ) AS hello ON hello.t1_sku = i.itemid
WHERE (t.recordtype IN ('cashsale', 'salesorder'))
  AND tl.quantity > 0
GROUP BY i.itemid, hello.t2_sku, hello.numerator
ORDER BY i.itemid
Do you have any ideas on how we can implement this as a dataset? My issue with recreating the dataset is that this query requires a self-join on the transaction lines table... have not yet figured out how to replicate that with a dataset.
w
I'd say that it is not possible with SuiteAnalytics Dataset, but happy if someone else corrects me. 🙂