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

Dynamic Title base on Variable

I am wanting to create a title for a chart that has a dynamic label for MonthYear. 

I have a variable for Current Month and Previous Month.  How do I get this variable to point to the MonthYear field in the dynamic title in the chart so I can display the Previous Month?

Current Month variable is vMaxMonth. The expression I used is =Max(PeriodID).

Previous Month variable is vPrevMonth. The expression I used for that is =vMaxMonth -1.

Your help is greatly appreciated!

5 Replies
Anonymous
Not applicable
Author

Hi Chris, could you please post an example? An image maybe, your request is not clear

ElizaF
Creator II
Creator II

Hello,

For dynamic label of the Month Year in title char or table, you can use the function:

='Month'&monthname(today()) - for current month

='Month '&MonthName(addmonths(today(0),-1)) - for previos month

or

='Month'&monthname(Date) - for month year selection - if you have the date in fact table.

It is importat to set the MonthNames variable at the beging of the script.

SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';

But it would be easier, as written also Oscar, to post an example

Anonymous
Not applicable
Author

Hi,

Try it.

='Current Year-Month' &' '& Date(Today(),'YYYY-MMM')

=' Previos Year-Month' &' '& Date(Addmonths(Today(),-1),'YYYY-MMM')

Regards

Anonymous
Not applicable
Author

Thank you all for your responses.

I have the month thing figured out.  Now its a matter of getting this to work for Quarters.  Any ideas?

Anonymous
Not applicable
Author

=Dual('Q' & Ceil(Month(Today())/3), Ceil(Month(Today())/3))