Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Need to Create the Red marked column in QV.

Hi All,

I need to calculate the Migrate column(shown in Red) in QlikView.  i Have the Quarter and Migrate# in my application as the same format you see below.

Can someone help to create the 3rd column(Migrate) in QV. The Total of Migrate#(134) is the start line and you need subtract the Migrate# number for the first time with the 1st quarter(134-4 =130) . The 130 here would be static till you find the new number in Migrate# and once you find subtract from it.  Hope i could try to explain properly. Please help me with the solution in QV.

QuarterMigrate#MigrateExplanation
134
Q1-004130134-4
Q1-15130
Q2-15130
Q3-15130
Q4-15130
Q1-161129130-1
Q2-16129
Q3-16129
Q4-1614115129-14
Q1-1712103115-12
Q2-172083103-20
Q3-1718283-1
Q4-1737982-3
Q1-1817879-1
Q2-1827678-2
Q3-18245276-24
Q4-18371552-37
Q1-1915015-15
134
1 Solution

Accepted Solutions
MarcoWedel

Hi,

this expression returns the sum of -Migrate# and either the last loaded "Migrate" value or, if not existing, i.e. in the first row, the TotalMigrate# number.

I used RangeSum because it returns results even if one parameter has no numeric value; it subtracts 0 in case of a non existing Migrate# value.

see also:

RangeSum

Alt

Peek

Please close your thread if your question is answered:

Qlik Community Tip: Marking Replies as Correct or Helpful

thanks

regards

Marco

View solution in original post

5 Replies
MarcoWedel

Hi,

maybe this could be a solution:

QlikCommunity_Thread_243126_Pic1.JPG

tabTemp:

LOAD Dual(F1,AddMonths(Date#(Right(F1,2),'YY'),(Mid(F1,2,1)-1)*3)) as Quarter,

    Migrate#

FROM [https://community.qlik.com/servlet/JiveServlet/download/1176614-257384/Migrate.xlsx] (ooxml, embedded labels, table is Sheet1, filters(Remove(Row, Pos(Top, 2)),Remove(Row, Pos(Top, 20))));

Join

LOAD Sum(Migrate#) as TotalMigrate#

Resident tabTemp;

tabResult:

LOAD Quarter,

    Migrate#,

    RangeSum(Alt(Peek(Migrate),TotalMigrate#),-Migrate#) as Migrate

Resident tabTemp

Order By Quarter;

DROP Table tabTemp;

hope this helps

regards

Marco

Anonymous
Not applicable
Author

Thanks Marco for the reply.

Can you please explain me how the below calculation works.

  RangeSum(Alt(Peek(Migrate),TotalMigrate#),-Migrate#) as Migrate 


Thanks

Ankit

MarcoWedel

Hi,

this expression returns the sum of -Migrate# and either the last loaded "Migrate" value or, if not existing, i.e. in the first row, the TotalMigrate# number.

I used RangeSum because it returns results even if one parameter has no numeric value; it subtracts 0 in case of a non existing Migrate# value.

see also:

RangeSum

Alt

Peek

Please close your thread if your question is answered:

Qlik Community Tip: Marking Replies as Correct or Helpful

thanks

regards

Marco

Anonymous
Not applicable
Author

Thanks Marco.. It was really helpful.

MarcoWedel

you're welcome

regards

Marco