Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
joydipp1988
Creator
Creator

YTD, MTD and LY YTD, LY MTD calculation problem

Dear all,

I'm in trouble to calculate YTD, MTD and LY YTD, LY MTD value. I'm describing my requirement as well as the problem I'm facing. I'm also attaching a sample app with two qvd's. Your earnest help will be appreciated.

I want to show Customer name wise Sales Value for MTD as well as LY MTD side by side. To calculate MTD & LY MTD, I'm using variables. Here are the variable description-

MTD:

vCY_CM_Start_Date:

=MonthStart(Max(TranDate))

vCY_CM_End_Date:

=Date(Max(TranDate),'DD/MM/YYYY')

LY MTD:

vLY_CM_Start_Date:

=MonthStart(Max(TranDate),-12)

vLY_CM_End_Date:

=AddMonths(Max(TranDate),-12)

Problem facing:

Selection: Year=2012, Month=Dec

With the above Selection, individual row wise values and total value is correct. But when I select "Aaron Hawkins" under Customar_Name field then its leaving all the selections as Aaron Hawkins has no value for Current Month.

My requirement:

Although Aaron Hawkins doesn't have any sale value for Current Month, I want to see CM and PM value side by side. My output for the below selections should look like this-

Selection- Year=2012, Month=Dec, Customer_Name=Aaron Hawkins

Customer Name
Current Month

Previous Month

Aaron Hawkins010051.63

Please go through the attachments. I will wait to hear from you.

Regards,

Joy

8 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

HI,

Have a look at the link for help.

Point-in-Time Reporting.qvw

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Chanty4u
MVP
MVP

joydipp1988
Creator
Creator
Author

Thanks for the reply. I wasn't looking for this kind of solutions actually. I'm familiar with YTD and MTD calculations, but I would like to get answer regarding the problem I'm facing right now in my app. Thats why I attached my app with QVDs.

If possible please focus on my app only. Thanks in advance.

Regards,

Joy

joydipp1988
Creator
Creator
Author

Can anyone figure out the problem I'm facing in my app ? Its very urgent. Help please.

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

You are facing issue because there is no data for previous Month for the selection you have done and thus you are unable to see the value as 0.

To get value as 0 you will have to populate the data.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
joydipp1988
Creator
Creator
Author

Thanks for the information. Let me try once. If I can't then I'll come back to you.

Regards,

Joy

engishfaque
Specialist III
Specialist III

Dear Joydip,

Please check your QVW, there is no data for Customer_Name "Aaron Hawkins" for the whole Year 2012.

You can check it by using listed below expression:

=Sum( {<Customer_Name = {'Aaron Hawkins'}>} SalesValue)

Kind regards,

Ishfaque Ahmed

Anonymous
Not applicable