Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
TomBond77
Specialist
Specialist

Expression for all existing Year(WBS)

Hi experts

A table with two different dimensions on year: Year(Production) and Year(WBS). The formula is as follows:  Sum({<[Year (Production)]={$(=max([Year (Production)]))}>}  [# open])

The result in the table is correct. If you remove the column for Year(WBS) the result changes to 5 which is incorrect. How do you modify above formula to get the correct result independent of a column Year(WBS) in the table?

TomBond77_0-1666257242297.png

 

Labels (5)
1 Solution

Accepted Solutions
BrunPierre
Partner - Master
Partner - Master

Try

Sum(Aggr(Sum({<[Year (Production)]={$(=max([Year (Production)]))}>} [# open]),Year (Production),Year(WBS)))

View solution in original post

3 Replies
BrunPierre
Partner - Master
Partner - Master

Try

Sum(Aggr(Sum({<[Year (Production)]={$(=max([Year (Production)]))}>} [# open]),Year (Production),Year(WBS)))

TomBond77
Specialist
Specialist
Author

Many thanks, this works!

How should this formula must look like to get the correct result?

RangeSum(Above(Sum({<[Year (Production)]=>} [# open]), 0, RowNo()))

 

 

BrunPierre
Partner - Master
Partner - Master

What do you want to achieve?

I believe the Year(Production) in the expression should not be a function but rather a field name

In the script, create

Year(Production) as [Production Year]

and apply as below

RangeSum(Above(Sum({<[Production Year]=>} [# open]), 0, RowNo()))