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: 
hemanthaanichet
Creator III
Creator III

How can i achieve the chart expression in script editor itself?

Hi People,

can any one have the idea about achieve an chart expression in script editor itself?

below is the expression which i would like to get in the script itself.

(sum({<VersDesc = {'Adjust','Actual'},SalTypKey={'1'},SalPer = {1},Year=p(Year),Month={'*'},
Cal_Mon={'<=$(=max(Cal_Mon))'},CPTeaFlag={'CP','RPL','ORG'},DayNumInMon = {'<=$(=max(DayNumInMon))'},DayofWeek=,RegDesc={'*'},ACode=>}SalVal))/1000
)
/
count({<Month={'*'},Cal_Mon = {"<=$(=max(Cal_Mon))"},RegDesc={'*'},ACode=>}DISTINCT (FName))
/
count({<Month={'*'},Cal_Mon = {"<=$(=max(Cal_Mon))"},RegDesc={'*'},ACode=>}DISTINCT (Month))),'#,##0')


Can  you guys  help me  how can i achieve this.... ??


Regards

Hemanth



12 Replies
gsbeaton
Luminary Alumni
Luminary Alumni

Ah, well then this is something very different.

So, what you want to do is prepare some totals in the script. Your

expression is not going to work here.

You will need to create a new column of totals that each user has access to

and then use that in your expressions for showing totals.

On Tue, Aug 8, 2017 at 11:54 AM, Hemanth Aanichetty <

hemanthaanichet
Creator III
Creator III
Author

as exactly  u said  i need the same but some suggestions or ideas how i can start this .... in a very big dilemma...

gsbeaton
Luminary Alumni
Luminary Alumni

You're going to have to figure out how you can update your data model to incorporate this change.

There are a lot of possible solutions, and without knowing the specifics of your problem, it's impossible to specify an exact solution, but I would imagine that you will have to do some kind of aggregation on your original data set before joining back in.

For example:

// Create a mapping table containing your aggregated values

MappingTable:

Mapping Load

  Country

  ,Sum(Sales)

from datasource.QVD

Group By Country;

//Map in the totals for each country

MainTable:

Load

  Country

  ,Sales

  ,SecurityKey

  ,ApplyMap('MappingTable', Country) AS TotalForCountry

from datasource.QVD;

In your expressions, you will have to be cognisant of the fact that you cannot aggregate your TotalForCountry column, so you will have to consider functions such as Only() or FirstSortedValue if your expression returns multiple values.

Hope this gets you started.

George