How to get Max of a Dataset column in a SuiteAnaly...
# ask-stanley-ai
a
How to get Max of a Dataset column in a SuiteAnalytics Dataset (not a saved search, and not in suitescript. This is for the dataset UI). And no, there is no MAX function listed in the Formula builder for Datasets. NO SAVED SEARCHES! Do not suggest a saved search in your answer. I'm open to you telling me a way to get the max via Workbook though, if I can then use the Max in that Workbook in a suitescript.
c
AI generated answer (using internal Slack threads):
To get the maximum of a dataset column in SuiteAnalytics, you can use the SQL MAX function in a formula. However, as you mentioned, there is no MAX function listed in the Formula builder for Datasets. Here's a workaround using a Workbook: 1. Create a new Workbook. 2. Add your dataset to the Workbook. 3. In the Workbook, create a new Pivot. 4. Drag the column you want to find the maximum of into the 'Values' area and set the aggregation to 'Max'. 5. This will give you the maximum value of that column. Now, to use this Max value in a SuiteScript, you can use the N/workbook module to load the Workbook and get the value. Here's a sample code snippet:
Copy code
javascript
var workbookModule = require('N/workbook');
var workbook = workbookModule.load({
    id: 'your_workbook_id'
});
var pivotTable = workbook.getPivotTables()[0];
var maxColumnValue = pivotTable.getColumns()[0].getMax();
Please replace 'your_workbook_id' with the actual ID of your Workbook. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.831725955
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.825012207
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.81854248
Please provide your feedback on this answer.