Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
alextomlins
Contributor III
Contributor III

Expression help - sum if user has a 1 in any week row for the month.

Hi guys,

Sorry for another question! I promise i am getting better

So we have a table which is created using interval match but it details a row for every week a user was active. So if a user was active for two weeks - it would have two rows - one for each week of activity. This is all linked via a master calendar split by date. Then to get an idea of total active users per week we just sum the ActiveCount and use a week dimension.

The problem is when i come to look at this at months. Because the user has an active count per week it creates dupes -

What i need it an expression to only count that user if they have an active count at all in any of the weeks associated with that month.

So it's SUM(ActiveCount) and then i use YearWeek as a dimension and because the table is weekly that comes out OK.

But if i count Sum(ActiveCount) with YearMonth if the user is active for two weeks it comes out as a count of 2 - which is wrong, because they were only active once in that month.

again - What i need it an expression to only count and active count for that month if the user has an active count in any of the weeks in that month.

I just really need the approach - i might be able to figure out the syntax.

6 Replies
alextomlins
Contributor III
Contributor III
Author

I think i may have solved it with Sum(IF([ActiveCount]>0,1,0)). Still looking to see if this has worked.

alextomlins
Contributor III
Contributor III
Author

Nope hahah

aunahsan
Partner - Contributor III
Partner - Contributor III

You have the right idea here i think. it would have to be :

IF(Sum([ActiveCount]) > 0, 1, 0)

Mark_Little
Luminary
Luminary

Hi,

Not sure i fully follow, But maybe try something like

IF(SUM(ActiveCount)>0,

     1,

     0)

Mark

zebhashmi
Specialist
Specialist

Maybe

if ([ActiveCount]) > 0,Sum([ActiveCount])

sasiparupudi1
Master III
Master III

May be try

Sum(

IF(

Aggr(Max([ActiveCount]),Month)>0,1,0

  )

)