Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
sarfaraz_sheikh
Contributor III
Contributor III

About Financial Year

Dear All,

I have the following format i want to calculate like below.

Product               FY1                 FY2         %growth

A                         100                  150           50%

B                         120                   150            25%

Year(YearStart(Max(Date-1),0,4) )-1  &' -'&  Year(YearStart(Max(Date) ,0,4)) As FY1

Year(YearStart(Max(Date-1),0,4) )  &' -'&  Year(YearStart(Max(Date) +1,0,4)) As FY2 or Current_fin_year

However Whenever i am reloading ...i am getting same error masage in above two  lines  "scrip Line Error " ...What wrong i have done i am unble to find .

Kindly help to achieve the same!!!!!!

Sarfaraz

5 Replies
rubenmarin

Hi Sarfaraz, when you use Max(Date) you need to load with a group by clause, in this 'group by' you need to put all field that are not aggregated, ie:

LOAD Company,

     Customer

     Max(Date) as Date,

     Sum(Sales) as Sales

From ...

Group by Company, Customer; // Date and Sales are aggregated, so they aren't in the Group by

sarfaraz_sheikh
Contributor III
Contributor III
Author

The abobe expression which i wrote ...is that write to calculate the financial year as per format.

Sarfaraz

PrashantSangle

Hi,

Use YearName()

Try like

YearNAme(date,0,4)

REgards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
cesaraccardi
Specialist
Specialist

Hi Sarfaraz,

I think it could be an issue with the Max() aggregation function, do you have a GROUP BY clause on your load statement? If so, are you listing all fields that are being loaded?

Cesar

rubenmarin

Hi Sarfaraz, I only posted a simple example so you can see the group by clause, that error message usually is related to the use of an aggregation function (Max, Min, Sum...) without a fully correct 'Group By' clause