Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Vivetha
Contributor
Contributor

Set analysis -- Priority

Hi,

 

Considers there are 3  Plans  that a mobile users can buy from Telecom operator : 

Plan 1 : Monthly Plan - (Priority 1)

Plan 2 : Weekly Plan - (Priority 2)

Plan 3 : Daily Plan - (Priority 3)

Consider the Following mobile users buy the below mentioned Plans according 

Mobile user 1 : Monthly plan, Weekly Plan and Daily Plan

Mobile user  2 : Monthly plan, Weekly Plan 

Mobile user 3:  Weekly Plan and Daily Plan

Mobile user 4 : Monthly plan, Weekly Plan and Daily Plan

Mobile user 5  :  Daily Plan

 

I want to find count of mobile users in  monthly plan , weekly plan and Daily plan respectively.

Mobile User1 should be considered as  Monthly plan user even though he has also bought Weekly plan and Daily plan  because Monthly Plan is higher priority

Mobile users 2 and Mobile User 3 are to be considered as Weekly Plan user even though they have bought Daily plan becasue Weekly plan is of Higher priority

So total subscibers  in each plan should be 

Monthy Plan : 3

Weekly Plan  : 1

Daily plan : 1

----------------------------

total : 5

Please help me in creating the Set analysis logic for the above requirement

 

Labels (1)
1 Solution

Accepted Solutions
MayilVahanan

HI @Vivetha 

Try like below

Table2:
Load *, Pick(Match(Mobile_plan, 'Monthly_Plan', 'Weekly_Plan','Daily_Plan'),1,2,3) as PlanNum Inline [
Mobile_user ,Mobile_plan
1 , Monthly_Plan
1 ,Weekly_Plan
2 ,Monthly_Plan
2,Weekly_Plan
3 ,Monthly_Plan
3,Weekly_Plan
4 ,Monthly_Plan
4,Weekly_Plan
5 ,Monthly_Plan
5,Weekly_Plan
6 ,Monthly_Plan
7 ,Monthly_Plan
8 ,Monthly_Plan
9 ,Monthly_Plan
10, Monthly_Plan
11 ,Daily_Plan
12,Weekly_Plan
11 ,Weekly_Plan
13,Daily_Plan
];
Join
Load Mobile_user, Min(PlanNum) as PlanNum, 1 as flag Resident Table2
Group by Mobile_user;

Front end:

dim: Mobile_plan

exp: Count({<flag={1}>}Distinct Mobile_user)

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

4 Replies
tresesco
MVP
MVP

@Vivetha ,

How is your data structure? Do you have a priority field in the model? Try to share a sample data set to work on.

Vivetha
Contributor
Contributor
Author

Hi , The priority field is not available in the model

 

Load * Inline [
Mobile_user ,Mobile_plan
1 , Monthly_Plan
1 ,Weekly_Plan
2 ,Monthly_Plan
2,Weekly_Plan
3 ,Monthly_Plan
3,Weekly_Plan
4 ,Monthly_Plan
4,Weekly_Plan
5 ,Monthly_Plan
5,Weekly_Plan
6 ,Monthly_Plan
7 ,Monthly_Plan
8 ,Monthly_Plan
9 ,Monthly_Plan
10, Monthly_Plan
11 ,Daily_Plan
12,Weekly_Plan
11 ,Weekly_Plan
13,Daily_Plan
];

 

Regards

MayilVahanan

HI @Vivetha 

Try like below

Table2:
Load *, Pick(Match(Mobile_plan, 'Monthly_Plan', 'Weekly_Plan','Daily_Plan'),1,2,3) as PlanNum Inline [
Mobile_user ,Mobile_plan
1 , Monthly_Plan
1 ,Weekly_Plan
2 ,Monthly_Plan
2,Weekly_Plan
3 ,Monthly_Plan
3,Weekly_Plan
4 ,Monthly_Plan
4,Weekly_Plan
5 ,Monthly_Plan
5,Weekly_Plan
6 ,Monthly_Plan
7 ,Monthly_Plan
8 ,Monthly_Plan
9 ,Monthly_Plan
10, Monthly_Plan
11 ,Daily_Plan
12,Weekly_Plan
11 ,Weekly_Plan
13,Daily_Plan
];
Join
Load Mobile_user, Min(PlanNum) as PlanNum, 1 as flag Resident Table2
Group by Mobile_user;

Front end:

dim: Mobile_plan

exp: Count({<flag={1}>}Distinct Mobile_user)

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Vivetha
Contributor
Contributor
Author

thank you @MayilVahanan