Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I am creating a new column from existing column in qliksense
Need to create the new column by summing the value row by row from existing column but there is 1 condition.
Condition is like we need to add value row by row when account=1 and if account=2 comes then select all previous values of account 1 and past for account 2
Please see below screenshot for more understandings
I have calculated this through expresion but my expression not working correcting as per my requirement on account=2 condition.
My expression is :-
=If(Account='1',Aggr(
RangeSum(Above(Sum(Amount), 0, RowNo()))
,Amount),above(total Amount))
My Output: -
If possible then please tell me how can i create this column from script too.
Kindly find attached dataset file .
Thanks
Demo_Tmp:
LOAD
RecNo() as Rec,
Account,
"Date",
"Type",
Amount
FROM Demo.xlsx
(ooxml, embedded labels, table is Dataset);
Demo:
Load *,
if(Account=1,RangeSum(peek('New Amount') , [Amount]),peek('New Amount')) as [New Amount]
Resident Demo_Tmp
Order by Rec;
Drop Table Demo_Tmp;
This looks like a PandL type of situation. I would suggest looking at one of the various PandL dashboards out there. Just a warning, PandLs require significant data model work to capture the type of functionality you are seeking.
Demo_Tmp:
LOAD
RecNo() as Rec,
Account,
"Date",
"Type",
Amount
FROM Demo.xlsx
(ooxml, embedded labels, table is Dataset);
Demo:
Load *,
if(Account=1,RangeSum(peek('New Amount') , [Amount]),peek('New Amount')) as [New Amount]
Resident Demo_Tmp
Order by Rec;
Drop Table Demo_Tmp;