Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
xyz2
Contributor III
Contributor III

Berechnung mit Above()

Hallo zusammen,

ich habe eine Kennzahl, die mir die wöchentliche Differenz ausrechnet und kumuliert:

RangeSum(Above(Count(Created_Date)-Count(Removed_Date)-Count(Closed_Date),0,RowNo()-1))
+ if(RowNo()=2, Above(Count(Created_Date)-Count(Removed_Date)-Count(Closed_Date)),0)

Und folgende Dimension, zur Berechnung der Kalenderwoche:

=Year([Created_Date]) &  '-'  & 'KW' & Week([Created_Date])

 

Das Problem ist, dass mir in der ersten Kalenderwoche 0 angezeigt wird, weil sie keine vorangehende Woche besitzt.
Ich suche nun nach einer Formel die, falls keine vorangehende Kalenderwoche existiert, einfach nur die aktuelle Woche ausrechnet.

Weiß vielleicht jemand wie ich mein Problem lösen kann?

1 Reply
hic
Former Employee
Former Employee

Will it not work if you just remove the "-1"? Then also current row will be included in the calculation. I.e.

RangeSum(Above(Count(Created_Date)-Count(Removed_Date)-Count(Closed_Date),0,RowNo()))

If not, you can always have a structure like

If(RowNo()=1, <Expression1>, <Expression2>)

Further, your dimension ought to use WeekYear() instead of Year():

=WeekYear([Created_Date]) & '-' & 'KW' & Week([Created_Date])