Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Aurél
Creator
Creator

Bar chart and active selection

Hello,

 

First, I have a selection "YEAR" and another "MONTH".

I have a bar graph with months in dimension.

If there is no selection, I would like the chart to show the months of the current year but the months must be less than the current month.

I defined two variables:

CURRENT_YEAR = Year(Today())

CURRENT_MONTH= date(Today(),'MM')

For my measurement, I have this:

IF(IsNull(GetCurrentSelections()),sum({<[MONTH={"<=$(CURRENT_MONTH)"},[YEAR]={$(ANNEE_EN_COURS)},[N]={'100','199'}>} [AMOUNT]),
sum({<$(=[YEAR]),[MONTH]={"<=0$(=MAX([MONTH]))"},[N°]={'100','199'}>} [AMOUNT]))

Moreover, it is a cumulative measure.

I removed the option: include null values.

It doesn’t work, if I don’t make a selection, my chart is on 2022 but I have data until December. I think that’s because of the cumulative— 

 

Could you please help me?

 

Thank you so much!

Labels (3)
1 Solution

Accepted Solutions
Aurél
Creator
Creator
Author

I found the solution in the parameters of the dimension :

=if(GetSelectedcount([Période RESULT_BILAN])>0 OR GetSelectedcount([Année RESULT_BILAN])>0,Max([Période RESULT_BILAN]),NUM(Month(Today())))

 

2022-08-26_13-46-28.png

View solution in original post

6 Replies
Mark_Little
Luminary
Luminary

HI @Aurél 

I would split the charts and get them working Individually first. Consider using  a container then to show the charts?

 

One problem might be related {"<=0$(=MAX([MONTH]))"}

try {"<=$(=MAX([MONTH]))"}

Also Getcurrentselections() will be looking for selections on any field.

Mario_De_Felipe
Luminary
Luminary

You could try this:

SUM({<[YEAR]={$(ANNEE_EN_COURS)},[MONTH]={"<$(=if(GetSelectedcount([MONTH])>0,Max([MONTH]),NUM(Month(Today()))))"}>} [AMOUNT])

 

 

Aurél
Creator
Creator
Author

Thank you but it doesn’t change anything.

Aurél
Creator
Creator
Author

If I select the year, it’s OK :

2022-08-23_15-40-40.png

Aurél
Creator
Creator
Author

But if I don’t select the year, it’s not OK :

2022-08-23_15-41-46.png

Aurél
Creator
Creator
Author

I found the solution in the parameters of the dimension :

=if(GetSelectedcount([Période RESULT_BILAN])>0 OR GetSelectedcount([Année RESULT_BILAN])>0,Max([Période RESULT_BILAN]),NUM(Month(Today())))

 

2022-08-26_13-46-28.png