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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Fix Values in Formula

Hello Guys,

I need some help. Actually i have this formula in a chart bar :

=avg(aggr(count({<[Fabricante_Codigo]={'344'}, Data={">$(=Date(addMonths(max(Data),-12)))<=$(=Date(max(Data)))" },Segmento={'Naked Big'} >}[Numero_Chassis]), Mesano))

With this calculated dimension:

=if(Date(Data) >= Date(MonthStart(AddMonths(Today(), -12))), Mesano)

This chart shows me 12 bars, about last 12 months. But, if somebody select a previous month (July, for example), it shows only 1 bar.

I've tried to set '1' in the set analysis, but it didnt worked, nothing change. My field 'Mesano' is the concatenation of :

Month & '-' & Year

The aggr function is to set the correct order of months. If i only use the Count formula, the months stays out of order.

How can i solve this?

Thanks !

28 Replies
Anonymous
Not applicable
Author

Hello Vlad,

Here it goes my problem. The sort need to be by 'MesAno'.

Need to select a previous month and it stays in order.

Thanks!

Anonymous
Not applicable
Author

As you can see, i want a bar chart of last 12 months (based on maxData). I dont want to select all months, just one and the analysis shows automatically.

Need some help.

Thanks Guys

vgutkovsky
Master II
Master II

Ah, sorry about that. Change your sort expression to: date#(only({<Mesano>}Mesano),'MMM-YY')

Vlad

Anonymous
Not applicable
Author

Hello Vlad !

It worked, thank you !

How can i sort by Year , Month and MesAno ?

Thank you !

Anonymous
Not applicable
Author

I need this, because the user will generate the report using only Month and Year, but my dimension of bar chart is MesAno. So can you tell me 2 expressions? 1 counting Mesano and other not.

Thanks!

vgutkovsky
Master II
Master II

Not sure I understand...it's already sorting by Year-Month.

Anonymous
Not applicable
Author

Yes it is, but it work only if i filter the application using the field Mesano.

If i filter using Month and Year, dont stay in order.

The user need to filter using the fields Month and Year, i dont know why its not working. But if we develop a expression in sort tab, using 2 fields : Year and Month, it will work.

Thanks !

Anonymous
Not applicable
Author

You can test it in the application which i did send.

The field Year is 'Ano' and Month is 'Mes'.

Anonymous
Not applicable
Author

I got it !

The expression is this :

date#(only({<Mes, Ano, Mesano>}Mesano),'MMM-YYYY')

Thank you Vlad !!