Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to calculate percentage difference based on month selection...?

Hi Guys,

I have requirement of calculating the percentage difference based on month selection.

I have one date field which contains two years of date 2014,2015 and in each year 12 months data are there and sales measure.

Now at the top of the chart i had placed an month filter. when ever i select a month of March then i need to display the percentage difference like (Current Year Month - Previous Year Month)/(Current Year Month) .

How to do the above calculation  in Qlikview. Can someone can help me.

Sample Data Set.PNG

Thank in Advance

Regards,

Venugopal G

Message was edited by: venugopal Gummadi

1 Solution

Accepted Solutions
Kushal_Chawda

=(sum({<Date ={">=$(=date(monthstart(max(Date)),'DD-MMM-YYYY'))<=$(=date(max(Date),'DD-MMM-YYYY'))"}, Year=,Month=>} Sales)

-

sum({<Date ={">=$(=date(monthstart(addmonths(max(Date),-1)),'DD-MMM-YYYY'))<=$(=date(monthend(addmonths(max(Date),-1)),'DD-MMM-YYYY')), Year=,Month=>} Sales))


/


sum({<Date ={">=$(=date(monthstart(max(Date)),'DD-MMM-YYYY'))<=$(=date(max(Date),'DD-MMM-YYYY'))"}, Year=,Month=>} Sales


View solution in original post

5 Replies
Chanty4u
MVP
MVP

Kushal_Chawda

=(sum({<Date ={">=$(=date(monthstart(max(Date)),'DD-MMM-YYYY'))<=$(=date(max(Date),'DD-MMM-YYYY'))"}, Year=,Month=>} Sales)

-

sum({<Date ={">=$(=date(monthstart(addmonths(max(Date),-1)),'DD-MMM-YYYY'))<=$(=date(monthend(addmonths(max(Date),-1)),'DD-MMM-YYYY')), Year=,Month=>} Sales))


/


sum({<Date ={">=$(=date(monthstart(max(Date)),'DD-MMM-YYYY'))<=$(=date(max(Date),'DD-MMM-YYYY'))"}, Year=,Month=>} Sales


Not applicable
Author

Hi Kush,

Thanks for you reply....

The above Expression was executed successfully.

Can you guide me how to apply Expression to the bar chart and Pie chart


Please do the needful.


Regards,

Venugopal G

Not applicable
Author

Thank you Kush,

Expression is working for my data.

Regards,

Venugopal G

Kushal_Chawda

awesome, glad to know that