Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Swathi
Creator
Creator

iam not getting previous year data

i have tkt_code, amount, cm2, cost of extras like so many columns are there.  recently for new developemnt we have ew materail and materail desc, because of each tktcode have have different materail description., suppose one tkt code has 6 materaildesc, i have 6 rows of data for each tktcode, amount, cm2 is also same value repeat 6 time beacuse of 6 rows of tkt code lines. 

previously directly sum(amount) , it will give vlaue, now i will take same formula if will high value, with same values repeted so many times, so that i need to take sum( distinct amount) for each tkt code. iam using below it is working fine.

Sum(Aggr(Only(amount), tkt_code))

i have created mastercalender in data load editor and have period in that have ytd , mtd, qtd,month year. for my ytd is default state always.

 iam using below formula. to ytd data

Previously formula before adding materail description using below formula to get cytd and pytd data- both are working fine

sum({1<CYTD ={1}>}amount), sum({1<PYTD ={1}>}amount),

now iam using below below formula

Sum(Aggr(Only({1<CYTD ={1}>} amount), tkt_code)) - working fine

sum({1<PYTD ={1}>}amount)- this formula still works fine, but i should n't use this it will giveworng results, i need  distinct amount of data for each code ticket code.

Sum(Aggr(Only({1<PYTD ={1}>} amount), tkt_code)) - not getting data,

Kindly help me to sort above formula, do i need to do any thing in the backend(dstatload editior) or in front end. i need to distinct sum of amount for each tkt code for previous YTD. iam attaching sample file. Please help me to resolve the issue

@BrunPierre 

Labels (2)
3 Replies
BrunPierre
Partner - Master
Partner - Master

Perhaps

Sum({1<PYTD={1}>} Aggr({1} Only({1} amount), tkt_code))

Swathi
Creator
Creator
Author

@BrunPierre , Thanks for the reply,

for below formula,  same i need to take distinct amount for each tkt code. previously iam using below formula.

Sum({<tkt_Year=,MonthYear=,[tkt_date]={$(PY)}>} amount),

now iam trying tried below formula to take distinct amount for each tkt code

Sum(Aggr({<tkt_Year=,MonthYear=,[tkt_date]={$(PY)}>} distinct amount,tkt_code))

this one again giving current yeay data . i have selected month year- dec-2023, nov-2023, previous year data is dec-2022, nov 2022, bit it is giving again dec-2023, nov-2023 same data, in the below screenshots  we can see. Please help me. didn't why again it is cy year data slection 

Swathi_0-1715146562607.png

Swathi_1-1715146675874.png

 in the below formula  it is same previous year data is not coming

Sum({<Period,[MonthYear]={ ">=$(=(vLimitPrevious_Min) )<=$(=(vLimitPrevious_Max) )" }>} amount)- previous using formula

 

current tried formula- but not getting previous year data. please help

Sum( Aggr(
only({<[MonthYear] = {"$(= '>=' & vLimitPrevious_Min & '<=' & vLimitPrevious_Max)"}>} amount),
tkt_code
))
))

BrunPierre
Partner - Master
Partner - Master

Use the dollar sign expansion ($) to evaluate the variables within the modifier

or

...tkt_date= {">=$(=Date(AddYears(YearStart(Max(tkt_date))),-1),'DD/MM/YYYY'))<=$(=Date(AddYears(Max(tkt_date),-1),'DD/MM/YYYY'))"}...