Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

correct Sum

Hi all!  I have the following table in QV

Table.JPG.jpg

when Oklad =

if(Column(1)>0,Sum(If(vDate_2>=DateStart2 and (isNull(DateEnd2) or DateEnd2> vDate_2), Oklad)))

The results I want is:

Itog.JPG.jpg

In other words, I want to get the correct Sum. Help me, please.

1 Solution

Accepted Solutions
Not applicable
Author


Stavki =

=SUM(If(vDate>=DateStart and (isNull(DateEnd) or DateEnd> vDate),Stavki))

The correct answer:

Oklad =

Sum(Aggr(if(SUM(If(vDate>=DateStart and (isNull(DateEnd) or DateEnd> vDate),Stsvki))>0,

Sum(If(vDate_2>=DateStart2 and (isNull(DateEnd2) or DateEnd2> vDate_2), Oklad))),Organization,Subdivision1,Subdivision2,Subdivision3,Subdivision4,Subdivision5,Subdivision6, Work))

all thanks! 😃

View solution in original post

8 Replies
Not applicable
Author

Hi,

You can may be use dimensionality() function and use distinct when calculating for Totals and for the others just use the normal expression.

Anonymous
Not applicable
Author

I suspect that the condition Column(1)>0 is the source of the problem.  It may be false for a single row which will be hidden, but the total >0, hence the values of Oklad included in total.  Try to think of a different condition.  Or, maybe this, moving this condition inside sum:

Sum(If(Column(1)>0 and vDate_2>=DateStart2 and (isNull(DateEnd2) or DateEnd2> vDate_2), Oklad))


Not applicable
Author

Michael, Sum(If(Column(1)>0 and vDate_2>=DateStart2 and (isNull(DateEnd2) or DateEnd2> vDate_2), Oklad)) - wrong.

Get all  0,00 (

PrashantSangle

Hi,

Try This,

if(Column(1)>0,If(vDate_2>=DateStart2 and (isNull(DateEnd2) or DateEnd2> vDate_2),Sum(Oklad)))

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 🙂
Not applicable
Author

Hi, if(Column(1)>0,If(vDate_2>=DateStart2 and (isNull(DateEnd2) or DateEnd2> vDate_2),Sum(Oklad))) get all -

PrashantSangle

Hi,

Then you can use Aggr()

Like

if(Column(1)>0,If(vDate_2>=DateStart2 and (isNull(DateEnd2) or DateEnd2> vDate_2),Aggr(Sum(Oklad),Work,Stavki))


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 🙂
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

You could try

if(Column(1)>0,

  Aggr(

  Sum(If(vDate_2 >= DateStart2 and (isNull(DateEnd2) or DateEnd2 > vDate_2), Oklad))

  , DateStart2, DateEnd2, Work, Organization

  , Subdivision1, Subdivision2, Subdivision3, Subdivision4, Subdivision5, Subdivision6

  )

)

The chart dimensions need to be included in the Aggr()

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author


Stavki =

=SUM(If(vDate>=DateStart and (isNull(DateEnd) or DateEnd> vDate),Stavki))

The correct answer:

Oklad =

Sum(Aggr(if(SUM(If(vDate>=DateStart and (isNull(DateEnd) or DateEnd> vDate),Stsvki))>0,

Sum(If(vDate_2>=DateStart2 and (isNull(DateEnd2) or DateEnd2> vDate_2), Oklad))),Organization,Subdivision1,Subdivision2,Subdivision3,Subdivision4,Subdivision5,Subdivision6, Work))

all thanks! 😃