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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
calvintang
Contributor III
Contributor III

RangeSum() and Peek() -> Not working in Data Load Editor

This is my script:

 

Daily_Population:
LOAD

monthname([date_signed]) AS [Month Year],
Count(DISTINCT [PlayerI_D]) as CountofPlayers,
RangeSum(Count(DISTINCT [Player_ID]),peek(CumulativeCountofPlayers)) as CumulativeCountofPlayers

RESIDENT [alpha_fact_client_info]
GROUP BY monthname([date_signed]);

 

My end goal is something like this:

Month | Population | Total Population (Running)

Jan 2022 | 10 | 10

Feb 2022 | 5 | 15

Mar 2022 | 30 | 45

Apr 2022 | 50 | 95

 

It keeps throwing me an invalid expression error!

 

Labels (1)
1 Solution

Accepted Solutions
MarcoWedel

maybe this works for you?

Daily_Population:
LOAD *,
     RangeSum(CountofPlayers,Peek(CumulativeCountofPlayers)) as CumulativeCountofPlayers;
LOAD MonthName(date_signed) as [Month Year],
     Count(DISTINCT PlayerI_D) as CountofPlayers
RESIDENT [alpha_fact_client_info]
GROUP BY monthname([date_signed])
Order By date_signed;

 

View solution in original post

3 Replies
marcus_sommer

Just do it in two steps - at the first load aggregating the values and within a second sorted resident-load you cumulate the results with rangesum() + peek().

- Marcus

MarcoWedel

maybe this works for you?

Daily_Population:
LOAD *,
     RangeSum(CountofPlayers,Peek(CumulativeCountofPlayers)) as CumulativeCountofPlayers;
LOAD MonthName(date_signed) as [Month Year],
     Count(DISTINCT PlayerI_D) as CountofPlayers
RESIDENT [alpha_fact_client_info]
GROUP BY monthname([date_signed])
Order By date_signed;

 

calvintang
Contributor III
Contributor III
Author

This worked! Thank you!