Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
qv_testing
Specialist II
Specialist II

Max year of previous month by default

Hi Community,

I'm facing with one issue,

I have tried many expressions, but no luck.

I'm using this expression:

=Sum({< Month={$(=Month(AddMonths(Date#(MaxString(Month), 'MMM'), -1)))}>}Amount)

this expression working, when i make selection  only

If i clear all not showing value, that should be Max year and Previous month (Means Jan 2018 data )

Thanks in Advance..!!!!

2 Replies
Anil_Babu_Samineni

I can ask one thing, Create one field from Month to Month_Num like

Num(Month(Date#(Month, 'MMM'))) as Month_Num


And Measure like this?

If(GetFieldSelections(Month)>0, Sum({< Month={$(=Month(AddMonths(Date#(MaxString(Month), 'MMM'), -1)))}>}Amount), Sum({<Year={$(=Max(Year))}, Month_Num={$(=Min(Month_Num))}>} Amount))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
jaumecf23
Creator III
Creator III

Try something like this :

- Year : =max(Year)

- Previous Month : =Month(Date#(Max({<Year={$(=max(Year))}>}Month),'MM')-1)