Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
vdcastro
Partner - Contributor III
Partner - Contributor III

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
pradosh_thakur
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.
vdcastro
Partner - Contributor III
Partner - Contributor III
Author

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

pradosh_thakur
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.
vdcastro
Partner - Contributor III
Partner - Contributor III
Author

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