Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Guys,
I have a field in my master calendar for MonthYear (MMM-YY)
I also have a field in there to Flag certain days (contains 1 or 0)
The MasterCalendar data holds a record for each day.
I want to produce another table which will sum all of the flags that contain 1 for each MonthYear.
I tried something like this:
SumFlags:
LOAD MonthYear,
SUM(Flags)
RESIDENT MasterCalendar;
But Qlikview gave me an error.
I would like it end up with a table as below:
MonthYear FlagTotal
Jan-12 15
Feb-12 18
Mar-12 20
Can anyone help with getting the right script for this?
Thanks
L
If you use an aggregation function like sum then all the fields not used in the aggregation functions need to be included in a group by clause.
SumFlags:
LOAD MonthYear,
SUM(Flags)
RESIDENT MasterCalendar
group by MonthYear;
Hello,
Try Sum(if(Flags=1,'1','0'))
Best.
It gave me an 'Invalid Expression' error
I changed slightly to
Sum(if(Flags=1,'1','0')) AS FlagCount
If you use an aggregation function like sum then all the fields not used in the aggregation functions need to be included in a group by clause.
SumFlags:
LOAD MonthYear,
SUM(Flags)
RESIDENT MasterCalendar
group by MonthYear;
Perfect!
Did exactly what I needed.
Thank you so much for your Help Gysbert