Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear All,
I want to calculate current month and previous month difference of a data.
I got the output when i take a single dimension but when I am taking multiple dimension it is not coming.
I have attached both the qlikview file Please check and do the needful.
In the attached qlikview-groupby.qvw I am getting output for the single dimension
but in attached ytdapplication.qvw i am not getting the output as I have attached another field GL description in it.
Kindly let me know any further details you want form my side.
Regards
Tripati
Do you need this in your if statement?
Peek(Date)=Date?
May be this:
Data3:
Load RowNo(),
FiscalYear,
MonthName,
Date,
//PK,
CalenderYear,
CalenderMonth,
fMonth,
FinancialYear,
FinancialMonth,
[GL Description],
Data,
If(RowNo() = 1, RangeSum(Data, 0),
If(Peek([GL Description])=[GL Description],-1*(RangeSum(Peek(Data),0)-numsum(Data)),RangeSum(Data,0))) as CurrentMonthValue
Resident Data2
Order By [GL Description] asc,
Date asc;
I think you need to order by GL Description also
Data3:
Load RowNo(),
FiscalYear,
MonthName,
Date,
//PK,
CalenderYear,
CalenderMonth,
fMonth,
FinancialYear,
FinancialMonth,
[GL Description],
Data,
If(RowNo() = 1, RangeSum(Data, 0),
If(Peek(Date)=Date and Peek([GL Description])=[GL Description],-1*(RangeSum(Peek(Data),0)-numsum(Data)),RangeSum(Data,0))) as CurrentMonthValue
Resident Data2
Order By [GL Description], Date asc;
Add [GL Description] in order by clause like below
Data3:
Load RowNo(),
FiscalYear,
MonthName,
Date,
//PK,
CalenderYear,
CalenderMonth,
fMonth,
FinancialYear,
FinancialMonth,
[GL Description],
Data,
If(RowNo() = 1, RangeSum(Data, 0),
If(Peek(Date)=Date and Peek([GL Description])=[GL Description],-1*(RangeSum(Peek(Data),0)-numsum(Data)),RangeSum(Data,0))) as CurrentMonthValue
Resident Data2
Order By
Date asc,
[GL Description] asc
;
Thanks for your reply sunny
But output is not coming.
Am I doing any mistake in peek function.
Regards
Tripati
Do you need this in your if statement?
Peek(Date)=Date?
May be this:
Data3:
Load RowNo(),
FiscalYear,
MonthName,
Date,
//PK,
CalenderYear,
CalenderMonth,
fMonth,
FinancialYear,
FinancialMonth,
[GL Description],
Data,
If(RowNo() = 1, RangeSum(Data, 0),
If(Peek([GL Description])=[GL Description],-1*(RangeSum(Peek(Data),0)-numsum(Data)),RangeSum(Data,0))) as CurrentMonthValue
Resident Data2
Order By [GL Description] asc,
Date asc;
Thanks Sunny,
Superb
Its working fine,
If I want to calculate previous month - current month where i have to change.
Regards
Tripati
In the script? May be this:
May be this:
Data3:
LOAD *,
Data - CurrentMonthValue as NewColumn;
Load RowNo(),
FiscalYear,
MonthName,
Date,
//PK,
CalenderYear,
CalenderMonth,
fMonth,
FinancialYear,
FinancialMonth,
[GL Description],
Data,
If(RowNo() = 1, RangeSum(Data, 0),
If(Peek([GL Description])=[GL Description],-1*(RangeSum(Peek(Data),0)-numsum(Data)),RangeSum(Data,0))) as CurrentMonthValue
Resident Data2
Order By [GL Description] asc,
Date asc;
Hi,
where i have to change in the following code to get the previousmonth - current month data
If(RowNo() = 1, RangeSum(Data, 0),
If(Peek([GL Description])=[GL Description],-1*(RangeSum(Peek(Data),0)-numsum(Data)),RangeSum(Data,0))) as CurrentMonthValue
Regards
Tripati
May be this:
If(RowNo() = 1, RangeSum(Data, 0),
If(Peek([GL Description])=[GL Description],-1*(RangeSum(Peek(Data),0)-numsum(Data)),RangeSum(Data,0))) - Data as Change