Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Need chart expression help!

Hello.

I'm trying to get a grand total of two fields in a chart expression but it will not return the right amount.(dimension is Yearweek)

Field1 is the latest exchange rate

Field2 is row price

I want the expression to first calculate field1 multiplied by field2, and then return the total amount of the calculated value for each week showing up in the chart. I have tried this expression but it returns the wrong value.

=sum(Field1*Field2)

Please help me with the right expression!

Patric

9 Replies
anderslinden
Partner - Contributor III
Partner - Contributor III


Hi! Depending on how your data is structured in tables behind, you probably need to use som kind of AGGR-expression, over the dimension YearWeek Check that out and try.
Good luck,
Anders

BI Consultant, Business Information Providers
www.bipab.se
Anonymous
Not applicable
Author

The data is like this:

Yearweek   Field1   Field2

201202       8,85     1000

201202       8,85     2000

201203       1,00     500

201203       8,85     1500

201204       1,00     1000

I need to show this in a bar chart with dimension Yearweek.

And the value i want to show is the total value of field1*field2 for each week.

(above Yearweek 201202 should show the value 26550)

Patric

anderslinden
Partner - Contributor III
Partner - Contributor III

Hi!
This is what you need to put as expression then:
Aggr(Sum(Field1*Field2),Yearweek)


/Anders
BI Consultant, Business Information Providers
www.bipab.se
anderslinden
Partner - Contributor III
Partner - Contributor III

Did it solve your problem?

BI Consultant, Business Information Providers
www.bipab.se
Anonymous
Not applicable
Author

Yes and No.

I did another Join load in the script then the original expression worked(=sum(Field1*Field2)..

So you were right in your first answer, so i checked my tablestructure and did some change.

But i have another one for you!!

I need to count the rows of a field, but only the rows thats not 0.

How do i write that expression??

Patric

anderslinden
Partner - Contributor III
Partner - Contributor III

Hi!
Do you mean in a straight table chart or in the database? Please give more info to explain the problem.

BI Consultant, Business Information Providers
www.bipab.se
Anonymous
Not applicable
Author

Hi.

When i use this expression: count([Totradpris]) in a stright table chart, Qlikview will count all the rows in that table with a value in field Totradpris.

But i want it only to count the rows in Totradpris where Totradpris is not 0.

count(Totradpris) where Totradpris<>0

Patric

Not applicable
Author

try Count({$<Totradpris -= {0}>}Totradpris) (a minus sign followed by an equal to sign)

Anonymous
Not applicable
Author

Hi Jasleen!

I tried your expression but i could not get i to work.

but then a chang the expression to this: =count(Totradpris)-count({$<Totradpris={'0,00'}>}Totradpris) then it worked fine.

Thank you for the help!

Patric