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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
sunainapawar
Creator
Creator

Dynamic labels for Previous Year and Month in Qliksense

Hello,

 I have a requirement to show 2 KPI's. Current Month Sales and Previous Month Sales KPI. The Labels for Current Month KPI should appear as Jan 2020 and for Previous Month KPI, should be as Dec 2019. Based on Selection of Year and Month , the label Name must change. If we select FYear as 2019 then Current KPI should show as 'Dec 2019' and Previous Month KPI should show 'Nov 2019'.

I have tried below expressions for Previous Month Label, but they are not working. Upon selection of Year 2020, it shows correctly as 'Dec 2019'. but when we select Fyear as 2019 and Month as Dec, then the label displays as 'Nov 2018'. It is taking the wrong year, since the selection is 2019 it should take 2019, but it shows 2018.

= MonthName(MonthStart(Max(sap_invoice_date),-1))

Please help to checkon this.

Thanks on Advance

 

 

 

1 Solution

Accepted Solutions
Kashyap_R
Partner - Specialist
Partner - Specialist

Hi

your expression and @UserID2626 's expression both are working for me.

if those didn't help try this 

MonthName(Addmonths(Max(OrderDate),-1))

or

Month(Addmonths(Max(OrderDate),-1))&' '&year(Addmonths(Max(OrderDate),-1))

 Hope this helps 

Thanks

Thanks and Regards
Kashyap.R

View solution in original post

6 Replies
UserID2626
Partner - Creator III
Partner - Creator III

Your expression is correct, check all the field selections.

Try this

MonthName(Max(Date),-1)

Kashyap_R
Partner - Specialist
Partner - Specialist

Hi

your expression and @UserID2626 's expression both are working for me.

if those didn't help try this 

MonthName(Addmonths(Max(OrderDate),-1))

or

Month(Addmonths(Max(OrderDate),-1))&' '&year(Addmonths(Max(OrderDate),-1))

 Hope this helps 

Thanks

Thanks and Regards
Kashyap.R
sunainapawar
Creator
Creator
Author

Hi,

Thanks for the reply. Below expression works fine when no Year and Month are selected, but when Year 2019 is selected and month for example Nov is selected , then the label is displayed as Oct 2018 which is wrong. It should ideally display Oct 2019. I have attached the screenshot of application. 

Thanks in advance.

 

 
Kashyap_R
Partner - Specialist
Partner - Specialist

Hi

The expression is working for me even if I select year and month, Can u please share a sample Qvf, I will try and get back to you

Thanks

Thanks and Regards
Kashyap.R
sunainapawar
Creator
Creator
Author

Hi,

It works fine without Calendar. We have created a Fiscal Calendar On basis of Financial month from April till March. 

Due to this, on selection of Year 2019 and Month Nov, the label is returning as Oct 2018. Its considering the previous Year.

Could you please help on this.

Thanks.