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: 
jubarrosor
Partner Ambassador
Partner Ambassador

Acumulative sum from year start

Hi,

I've got one question:

I need to create a bar chart. I'm using MonthYear as dimension and the expresion must to calculate:

    

     sum(SALES) in current month / sum(SALES) from first day of month to current month.

Example:

MonthYearSalesOfCurrentMonthSalesOfYearMyExpression
Oct14101010/10
Nov14203020/30
Dec14104010/40
Jan15101010/10
Feb15203020/30
Mar15154515/45
Apr155505/50

I've problems to calculate the sales of the year, the condition are ignored and QV only sum the sales of the current month.

SUM({<MonthYear={">=YearStart(max($=MonthYear))}",

              MonthYear={"<=max($=MonthYear)"}>} SALES)

Thak you!

Best Regards!

PS: the expression is an example. It's not a syntax problem 😉

1 Reply
ramoncova06
Partner - Specialist III
Partner - Specialist III

would have to see how your months are defined, but might work if you switch it to min

SUM({<MonthYear={">=YearStart(min($=MonthYear))}",   MonthYear={"<=max($=MonthYear)"}>} SALES)