Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem while using MonthName in the expression for calculation

Hi All,

I want the sales growth this month when compared to last month in gauge chart. Wants to the display the current month name in words instead of numbers in the chart.

What in need to show the month name in years. As i can't calculate the current month and previous name in the expression MonthName-1 as the values are in words. It can to be calculate using Month-1 and that name should be displayed in words. Please help me out!

Have attached my sample application with this.

24 Replies
Not applicable
Author

Hi Rahul,

Thanks for your reply. Can you please do the same in my application. If you don't mind.

Thanks in advance!

Not applicable
Author

Hi ,

i was just changed your exp like this and this is working Properly

=Month(MakeDate(Year(Today()),Max(Month),Day(MonthStart(Today())))) & ' vs ' & Month(MakeDate(Year(Today()),Max(Month)-1,Day(MonthStart(Today())))) & ' Sales Growth @ ' & num(Sum({$<Month={$(=Max(Month))}>} SalValue) / Sum({$<Month={$(=Max(Month)-1)}>} SalValue), '#%')

Not applicable
Author

Hi Rahul,

Thanks for your reply. Can you attachment the same document where you have made the changes. Attached document doesn't have any changes when compared to mine. It will be understandable if make the required changes in document and attach it.

Not applicable
Author

Hi,

Updated file is attached..

Not applicable
Author

Hi Rahul,

Thanks for your help. I am happy that it shows the month name in words. But when I make the selection in month it doesn't work. It shows "Too Few Expressions" message same as before. Let me know what to done now.

What i mean to say is that in the month list box month will be there in words only. Gauge graph should work when i select the the month from list box when it is in words.

Look into the attached list box. Here the month are displayed in words and the gauge graph doesn't seems be working when you make selection in that.

Help me out! Thanks in advance!

Not applicable
Author

Hi,

please find attached file and micro to understand ....

Not applicable
Author

Hi Rahul!
It's perfect now. Will be thankful to you if you can explain me about the script which you wrote in general tab. Max(Month) and Max(Month-1) is understandable but i am not able to understand rest of things especially Month(MakeDate(Year(Today()) and Day(MonthStart(Today())))) and how it works in between Max(Month) and Max(Month-1).

Also let me know you written this script in the general tab and there is no changes in the expression. Max(Month) and Max(Month-1) is not altered in the expression tab. Let where it is used and how it works now though the month name is in words and previously it was not working when the month name is in words.

Thanks in advance!


--------------------SCRIPT--------------------

=Month(MakeDate(Year(Today()),Max(Month),Day(MonthStart(Today())))) & ' vs ' & Month(MakeDate(Year(Today()),Max(Month)-1,Day(MonthStart(Today()))))

=Month(MakeDate(Year(Today()),Max(Month),Day(MonthStart(Today())))) & ' vs ' & Month(MakeDate(Year(Today()),Max(Month)-1,Day(MonthStart(Today())))) & ' Sales Growth @ ' & num(Sum({$<Month={$(=Max(Month))}>} SalValue) / Sum({$<Month={$(=Max(Month)-1)}>} SalValue), '#%')

Not applicable
Author

Hi,

i just write a macro that you can see in the macro module (CTL + M).

that is activated on the monthname selection field in that i have selected respective month field value as set expression is depend on month field.

thats why it was working fine ..

to know more about macro please go through the API guides .

C:\Documents and Settings\ProgramFiles\Qlikview\documentation\API guides Application as it was installed by default

about :

Month(MakeDate(Year(Today()),Max(Month),Day(MonthStart(Today()))))

in this according to month selection i was created date by using MakeDate function and then take month of that date using Month Function ..

so we got month name in words.

this is one of the approach , instead you can us subfield function as suggested above that is more optimized than this functions..

Not applicable
Author

Hi Rahul!

Thanks for the explanation. But i will look into it after solving this problem which i am facing.

Your idea doesn't seems to be working. For more information please check with attached document.

If i select 4 in the Month and 2009 in the Year i am able to see the sales growth in the gauge. But if i select the Apr in the MonthName and 2009 in the Year i am not able to see the sales growth.

Why it is not showing the sales growth when i select the same month in the monthname like what i have selected in the month.

Hope you can give me solution for this.

Not applicable
Author

Hi,

Then i hope you have use the same field as you have given the expression for the list box.

For example : you might have given label name as Monthname and in expression you have put the conditions.

Now in the chart expression call this same label it will give you the correct data, else you can put the same expression in the gauge graph.

It has to show.

Thanks,

Mahasweta