Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Script Help

Hi all,

Please help me on this scripting problem. For Example i has two table in my data

TableA:

Load ID

      Sales201507

      YearMonth

From

Sales201507.qvd(qvd);

Concatenate


Load ID

      Sales201507

      YearMonth

From

Sales201507.qvd(qvd);

After that, i need get the maximum sale in every month. How can i get the max sale in the script?Is it like this kind of way?

Final Result:

Load ID,

        Max(Sales&YearMonth) as MaxSales&YearMonth

Resident TableA

group by ID;

2 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

Yes, almost. This works better in my opinion:

[Final Result]:

Load YearMonth,

     Max(Sales) as MaxSales,

     FirstSortedValue(ID, -Sales) AS MaxSalesID

Resident TableA

group by YearMonth;;

This LOAD statement returns the maximum Sales per YearMonth, and adds the corresponding ID.

Best,

Peter

manojkulkarni
Partner - Specialist II
Partner - Specialist II


In Your Final Table,

Final Result:

Load ID,

        Max(Sales) as MaxSales

Resident TableA

group by ID, YearMonth;

Above load will give you aggregate table having below data

ID | YearMonth | MaxSales

If you need the data monthwise, then you should have month filed to do so. In existing data itself you can get month from you YearMonth column and follow the same.