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: 
Not applicable

how to calculate the field in script level....?

Hi All,

I am using the below expression in script level.But its not working what is the problem

I am calculating the Max month related data is store into current2015count field.

if(Created_date = date(max(Created_date),'MMM') ,[2015  Count 1],) as current2015count

13 Replies
timanshu
Creator III
Creator III

Hi Subbu,

As per Question, you are doing this by load statement.

If this is case, then you can't use aggregate functions in load statement without using group by clause.

But In your case using group by clause is not logical and will not either solve your problem.

So you first need to take a variable above this load statement and assign it  value as max(Created_date) :

Let vMaxDate = max(Created_date).

Then in load statement write the variable instead of max(Created_date). like :

if(Created_date = date('$(vMaxDate)','MMM') ,[2015  Count 1],) as current2015count


This will solve your concern.

jagan
Luminary Alumni
Luminary Alumni

Hi,

You need to use Group by if you are using Max() in Load script, attach some sample data and let us know your required output.

Regards,

Jagan.

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

I suggest you attach the load script for the table that contains the line in question.Sample data and a complete load script would also help.

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
avinashelite

can you please attach the app with sample data??

Not applicable
Author

Hi,

this is my sample data.


NamesubjectDatevalue Countmarks
mikeEnglish31-Jan-15020
mikemaths31-Jan-15021
mikescience31-Jan-15024
mikesocial31-Jan-15025
hariEnglish31-Jan-15222
harimaths31-Jan-15224
hariscience31-Jan-15226
harisocial31-Jan-15227
johnEnglish31-Jan-15418
johnmaths31-Jan-15420
johnscience31-Jan-15429
johnsocial31-Jan-15430
saiEnglish31-Jan-15120
saimaths31-Jan-15122
saiscience31-Jan-15124
saisocial31-Jan-15126
mikeEnglish28-Feb-15020
mikemaths28-Feb-15021
mikescience28-Feb-15024
mikesocial28-Feb-15025
hariEnglish28-Feb-15222
harimaths28-Feb-15224
hariscience28-Feb-15226
harisocial28-Feb-15227
johnEnglish28-Feb-15418
johnmaths28-Feb-15420
johnscience28-Feb-15429
johnsocial28-Feb-15430
saiEnglish28-Feb-15120
saimaths28-Feb-15122
saiscience28-Feb-15124
saisocial28-Feb-15126

and my expected design is:

NameBaseline ValuecountCurrent value countSubjectBaseline MarksCurrent Marks
mike00English2020
maths2121
science2424
social2525
hari22English2222
maths2424
science2626
social2727
john44English1818
maths2020
science2929
social3030
sai11English2020
maths2222
science2424
social2626

Plz help me in this part.

plz write the discussion in discussion window only.

Not applicable
Author

Hi,

this is my sample data.

NamesubjectDatevalue Countmarks
mikeEnglish31-Jan-15020
mikemaths31-Jan-15021
mikescience31-Jan-15024
mikesocial31-Jan-15025
hariEnglish31-Jan-15222
harimaths31-Jan-15224
hariscience31-Jan-15226
harisocial31-Jan-15227
johnEnglish31-Jan-15418
johnmaths31-Jan-15420
johnscience31-Jan-15429
johnsocial31-Jan-15430
saiEnglish31-Jan-15120
saimaths31-Jan-15122
saiscience31-Jan-15124
saisocial31-Jan-15126
mikeEnglish28-Feb-15020
mikemaths28-Feb-15021
mikescience28-Feb-15024
mikesocial28-Feb-15025
hariEnglish28-Feb-15222
harimaths28-Feb-15224
hariscience28-Feb-15226
harisocial28-Feb-15227
johnEnglish28-Feb-15418
johnmaths28-Feb-15420
johnscience28-Feb-15429
johnsocial28-Feb-15430
saiEnglish28-Feb-15120
saimaths28-Feb-15122
saiscience28-Feb-15124
saisocial28-Feb-15126

and my expected design is:

NameBaseline ValuecountCurrent value countSubjectBaseline MarksCurrent Marks
mike00English2020
maths2121
science2424
social2525
hari22English2222
maths2424
science2626
social2727
john44English1818
maths2020
science2929
social3030
sai11English2020
maths2222
science2424
social2626

Plz help me in this part.

plz write the discussion in discussion window only.

Not applicable
Author

Hi,

this is my sample data.

NamesubjectDatevalue Countmarks
mikeEnglish31-Jan-15020
mikemaths31-Jan-15021
mikescience31-Jan-15024
mikesocial31-Jan-15025
hariEnglish31-Jan-15222
harimaths31-Jan-15224
hariscience31-Jan-15226
harisocial31-Jan-15227
johnEnglish31-Jan-15418
johnmaths31-Jan-15420
johnscience31-Jan-15429
johnsocial31-Jan-15430
saiEnglish31-Jan-15120
saimaths31-Jan-15122
saiscience31-Jan-15124
saisocial31-Jan-15126
mikeEnglish28-Feb-15020
mikemaths28-Feb-15021
mikescience28-Feb-15024
mikesocial28-Feb-15025
hariEnglish28-Feb-15222
harimaths28-Feb-15224
hariscience28-Feb-15226
harisocial28-Feb-15227
johnEnglish28-Feb-15418
johnmaths28-Feb-15420
johnscience28-Feb-15429
johnsocial28-Feb-15430
saiEnglish28-Feb-15120
saimaths28-Feb-15122
saiscience28-Feb-15124
saisocial28-Feb-15126

and my expected design is:

NameBaseline ValuecountCurrent value countSubjectBaseline MarksCurrent Marks
mike00English2020
maths2121
science2424
social2525
hari22English2222
maths2424
science2626
social2727
john44English1818
maths2020
science2929
social3030
sai11English2020
maths2222
science2424
social2626

Plz help me in this part.

plz write the discussion in discussion window only.

currentcount means current month data baselinecount means jan month data it is fixed one

Not applicable
Author

currentcount means current month data baselinecount means jan month data it is fixed one.

Not applicable
Author

currentcount means current month data baselinecount means jan month data it is fixed one