Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
zagzebski
Creator
Creator

Set analysis - counting distinct

I am looking for set analysis help on the data below. Basically I need to count distinct groups that had less revenue in the current month than in the previous month. (in the example below group 3 and 5 had less revenue in the current month than the previous).

DATA:
DIVISIONGROUPYEARMONTHREVENUE
A120130190
A1201302100
A2201301110
A2201302120
A3201301150
A3201302100
B4201301100
B4201302125
B5201301140
B5201302100
RESULT:
DivisionYEARMONTH% of Groups with Less Revenue then Prior Month
A20130233%
B20130250%
11 Replies
zagzebski
Creator
Creator
Author

The Current And Previous Month indicators are working great. I will use that alot.

However the aggregation isn't.

I broke your expression into two fields. The distinct group count (denominiator) is simple and works fine. However counting the groups only if the current month is less than the previous month just always brings back 0's ("Group (if Curr < Prev)"  column)

The expression is:

count(if(aggr($(vBenFactorCur) - $(vBenFactorPrev),[Group ID],[Incurred Year Month (Analytical)]<0), [Group ID]))

Do you see anything wrong?

zagzebski
Creator
Creator
Author

Oops - my image didn't show up in my previous reply....

Incurred Year Month (Analytical)Groups ( if Curr < Prev)Distinct Groups
01402
20121101362
20121201353
20130101354