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

A simple maths question

Hi,

Sorry to ask a simple question like that, but I am a bit lost....

If I want to sum up data in a field, I use sum(field). How about *,- and / (times, minus and divide) the field??

Thanks,

Ivan

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

for the * there is a solution:#

exp(sum(log(field)))

For the other ones, I have to Think about it.

Regards Alex

View solution in original post

15 Replies
Not applicable
Author

This is not a Qlikview question, but more a BI question...

I mean sum is used to aggregate your data.

In qlikview *, -, / and + are working ...

Regards,

Sébastien

Not applicable
Author

Hi Spastor,

Sorry to cause confusion, here is the example.

I have Year and month as teh dimenions in graph and sum(Sales) as the expression.

Sales is actually a daily figure. And what QV do here is to add up all daily sales amount and put group the under different year and months.

If I reduce the dimenions by removing Months. All figures shown in table/graph is now yearly figure "ADD" by QV.

My question is, insteads of adding them, can I minus, time or divide them? (data in the same column).

Thanks,

Ivan

Not applicable
Author

Hum.... I don't really understand what do you want to divide...

Please give me an example if possible.

Not applicable
Author

Hi,

A bit tricky to explain. Let use multiply as examply.

In the table, I have a field:"survivial rate". So let say our daily dead rate from accident is 0.00001 .Then for a random person, his chance to survive 2 day is 0.99999*0.99999. for one month, we need to multiply everyday surviving chance.

Does it help?

Ivan

hector
Specialist
Specialist

hi, but this is pow(0.99999,2) not a sum()

any ideas?

Not applicable
Author

pow(sum(1-Rate),count(day)

Not applicable
Author

Thanks for everyone reply,

But not everyday having the same figures. They can be difference. Therefore, I can't use power.....

Ivan

johnw
Champion III
Champion III

Well, that's annoying. I'd really have expected there to be an expression for the product of matching field values, but I see nothing under aggregation. Searches for "product", "sequence" and "pi" (since a capital pi is how it is expressed) turn up nothing useful either.

So we'll have to fake it. If all of your numbers are 1 or greater:

max(aggr(Number*if(len(above(column(1))),above(column(1)),1),RecNo))

If all of your numbers are between 0 and 1:

min(aggr(Number*if(len(above(column(1))),above(column(1)),1),RecNo))

I can't seem to work out the general case. I'd have expected either of these to work, but the first returns nothing, and the second seems to give me a "random" number from the product sequence rather than the last number:

bottom(aggr(Number*if(len(above(column(1))),above(column(1)),1),RecNo))

subfield(concat(aggr(Number*if(len(above(column(1))),above(column(1)),1),RecNo),','),',',count(RecNo))

Not applicable
Author

Hi,

for the * there is a solution:#

exp(sum(log(field)))

For the other ones, I have to Think about it.

Regards Alex