Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
vinay1233
Contributor II
Contributor II

load date values and max(date) as columns in editscript gives Invalid expression?

error description:Invalid expression

ProductDates:

LOAD

Max(Dates))as MaxDate,

Dates as allDates

FROM

[..\Data Files\Excel\ProducSoldDates.xlsx]

(ooxml, embedded labels, table is Sheet1);

Cant we define script in this way, why is it failing to load as columns?

1 Solution

Accepted Solutions
sunny_talwar

Try this

ProductDates:

LOAD Dates as allDates

FROM

[..\Data Files\Excel\ProducSoldDates.xlsx]

(ooxml, embedded labels, table is Sheet1);

Join (ProductDates)

LOAD Max(Dates) as MaxDate

Resident ProductDates;

View solution in original post

3 Replies
sunny_talwar

Try this

ProductDates:

LOAD Dates as allDates

FROM

[..\Data Files\Excel\ProducSoldDates.xlsx]

(ooxml, embedded labels, table is Sheet1);

Join (ProductDates)

LOAD Max(Dates) as MaxDate

Resident ProductDates;

vinay1233
Contributor II
Contributor II
Author

thanks, can you explain the actual problem?

sunny_talwar

You cannot load Max(Dates) and Dates in a same table... because when you use an aggregation function such as Sum, Max, Min... etc... you need a Group By statement which include non-aggregating fields.... if you add Group By Dates... then Max(Dates) will essentially show the same Date for each Date

That is why you need to divide it into two pieces....

Does that make sense?