Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
bharatkishore
Creator III
Creator III

YTD Issue

Hi All,

I have a qvd with following fields

YearMonth,

     Calendar_Year,

     Plant,

     BUEqui,

     Strategic_Flag,

     Country,

     Contract_Type,

     Part_Type,

     Fiscal_Month,

     ITM_IB,

     ITM_Consumption

and to get YTD logic i have given the below condition:

FinalTable:


LOAD*,


If(BUEqui = Previous(BUEqui) and Plant = Previous(Plant)  and Calendar_Year = Previous(Calendar_Year) , RangeSum(ITM_Consumption, Peek('YTD_Consumption')), ITM_Consumption) as YTD_Consumption


Resident QV_intermediate_temp5


order by BUEqui,Plant,YearMonth ;


DROP Table QV_intermediate_temp5;


Below image for reference:


T.PNG


If you see my YTD_cons for Jan is fine but for feb instead of 1934+6913 =8847 i am getting 176974.


Can you please help where i am doing wrong.


Attached app for reference.


Thanks,

Bharat

1 Solution

Accepted Solutions
13 Replies
sunny_talwar

There are multiple rows with same dimension values... may be you want to Sum them before you calculate YTD_Consumption?

bharatkishore
Creator III
Creator III
Author

Yes Sunny Bhai.. Is there anything wrong in the data..

sunny_talwar

wrong with data... I don't know... wrong with way script is running... may be (because you are not getting the right output)

bharatkishore
Creator III
Creator III
Author

Yes, Can you please help how can i get it..

sunny_talwar

can you share your qvd?

bharatkishore
Creator III
Creator III
Author

Please find the attached qvd

bharatkishore
Creator III
Creator III
Author

In case if you got T9 qvd please don't use .. kindly use T10 qvd i have shared..

Please let me know if you need anything more..

sunny_talwar

Check attached

bharatkishore
Creator III
Creator III
Author

Thank You Sunny.

But if i select 4 months the value is getting wrong. Please find the attached app.

Below image for reference;T.PNG

Instead of 12350 i am getting 14822 and if i change any BUEQUI also the values are not getting same.

Can you please have a look..