Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Lucius_Artorius_Castus

How to show bar chart with sum of only latest month for each year

Hi, So I want to sum only latest month for each year like below

Lucius_Artorius_Castus_0-1707396117559.png

Right now as you can see i am able to generate this chart till 2023 with this expression SUM({<[CREATED_DATE-Year-Month.autoCalendar.MonthRelNo] = {"-10"}>} [FA_QTY_FUNC] * [AVERAGE_PRICE]) / 1000)
because it has latest month which is 12, but for 2024 latest month is Feb so I want to only sum for feb data
Please Let me know how should I achieve this.

Thanks.

Labels (1)
  • SaaS

11 Replies
Lucius_Artorius_Castus
Author

@Anil_Babu_Samineni Is there possible way to do this without data script? I am not using script for my dashboard, so Is there way we can do this in expression?

Lucius_Artorius_Castus
Author

I solved this by creating new two columns Latest_YM where I am storing latest month of specific year and second is YMFlag field I have created where I am subtracting both date fields if it is 0 then I put flag 0 otherwise 1
if (interval([Year-Month]-[YEAR_MONTH_CALC], 'd') = 0, 0 , 1)

Lucius_Artorius_Castus_0-1707483781335.png

And in expression I have filtered with SUM({<[YMFlag]={'0'}>} [FA_QTY_FUNC] * [AVERAGE_PRICE]) / 1000) 

Lucius_Artorius_Castus_1-1707484140092.png

 

 Thanks everyone for helping me. If there is better solution Let me know but this work for me for now.