Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Partner
Partner

Accumulated Bar Chart no working

Hello everyone,

I have a bar chart with the evolution of sales by month for Current Year and Prior Year with the following logic:

 

Dim1: Month

Dim2: =ValueList('PY','CY')

Measure:

PICK(MATCH(ValueList('PY','CY'),'PY','CY'),

//PY
num(
(
Sum({<
Year={$(vMaxPriorYear)},
MonthID={"<=$(vMaxPriorMonth)"}>}
Sales
,
//CY
num(
(
Sum({<
Ano={$(vMaxYear)},
MesID={"<=$(vMaxMonth)"}>}
Sales
)
)
/1000000 ,'#.###,# M€')
)

 

And it works fine. Now I want to create the evolution of sales accumulated by month for Current Year and Prior Year:

I want use the same dimensions

And I used this measure:

PICK(MATCH(ValueList('PY','CY'),'PY','CY'),

//PREMIOS PY

aggr(rangesum(above(

Sum({<
Ano={$(vMaxPriorYear)},
MesID={"<=$(vMaxPriorMonth)"}>}
Sales
)

,0,RowNo())),Month)

,
//PREMIOS CY

aggr(rangesum(above(

Sum({<
Ano={$(vMaxYear)},
MesID={"<=$(vMaxMonth)"}>}
Sales
)

,0,RowNo())),Mpnth)

)

I don't understand the result because the expression is not returning values to current year. I think I have a problem with the aggr with the dimension CY/PY

Can someone help me with this problem?

Thank you,

best regards

Sem Título.png

 

Labels (3)
4 Replies
Highlighted
Master II
Master II

Can you create table and bar char side by side. then check the sorting in both of them. Replicate the sorting of table to the barchart.

Learning never stops.
Highlighted
Partner
Partner

Thank you by your answer,

I have not values in the chart so the sort will not help.

I think the problem is the aggregation by the ValueList('PY','CY')  but I don't have a solution for that

Highlighted
Master II
Master II

I am sorry i didn't follow. You said bar chart is working . try as i said ,if it is not working we can look at the expression.

Learning never stops.
Highlighted
Partner
Partner

I want 2 charts.
The first with the sales by month (the first code of my message) and this is ok.
The second with the accumulated sales by month for CY and PY and this is not working. The table is only to debug the values.
I attached an image to try explain better my idea/problem