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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Praj
Helper I
Helper I

Aggregation of 3 tables for percentage as output

Hello Everyone! 

I have been stuck with a bit complicated problem and looking for some help. I have 3 tables as shown below:

Table 1:  Each user is tagged to a type which he/she belongs to 

Praj_0-1673285802495.png

 

Table 2:  Each type has certain activities under their buckets. For ex, Type 1 has Activity 1,2,& 3. Type 2 as only Activity 2 &3

Praj_2-1673285971749.png

 

Table 3:  This table provides information about user and the activities undertaken by them and the date when they took an activity

Praj_3-1673285999066.png

The above 3 are the input tables. 

 

What I am looking is to identify the % of activities taken by the users which are inline with the users type as shown below.

Praj_4-1673286440202.png

For ex, User 1 had taken 3 activities - Activity 1,3 and 1 again. All three activities are part of his type-Type 1 and hence the output says 100% of activities are part of his type. Similarly, User 2 had taken 3 activities- Activity 2,1, and 4 however only activity 2 is part of user 2's type and hence the output says-Only 33% of activities taken by User 2 is inline with his type.

 

I am trying to find a way in Power BI to automate this problem, any solution or any approaches for this problem is highly appreciated.

Thanks in advance!

 

Cheers,

Praj 


 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Praj 

 

You can try the following methods.

Measure = CALCULATE(COUNT(Table3[Activities]),ALLEXCEPT(Table3,Table3[User]))
Measure 2 = 
VAR _user = SELECTEDVALUE(Table3[User])
VAR _type = CALCULATETABLE(VALUES(Table1[Type]),Table1[User]=_user)
VAR _activity = CALCULATETABLE(VALUES(Table2[Activities]),'Table2'[Type] IN _type)
RETURN
CALCULATE(COUNT(Table3[Activities]) ,Table3[Activities] IN _activity)
% = DIVIDE([Measure 2],[Measure])

vzhangti_0-1673332277750.png

User4 has Activity 1, User4 corresponds to Type3, there is Activity 1 in Type3, and User4 should also be 100%.

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @Praj 

 

You can try the following methods.

Measure = CALCULATE(COUNT(Table3[Activities]),ALLEXCEPT(Table3,Table3[User]))
Measure 2 = 
VAR _user = SELECTEDVALUE(Table3[User])
VAR _type = CALCULATETABLE(VALUES(Table1[Type]),Table1[User]=_user)
VAR _activity = CALCULATETABLE(VALUES(Table2[Activities]),'Table2'[Type] IN _type)
RETURN
CALCULATE(COUNT(Table3[Activities]) ,Table3[Activities] IN _activity)
% = DIVIDE([Measure 2],[Measure])

vzhangti_0-1673332277750.png

User4 has Activity 1, User4 corresponds to Type3, there is Activity 1 in Type3, and User4 should also be 100%.

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-zhangti ,

 

Thanks for the solution. I was wondering is there any way to add date as a slicer and the values gets updated as per the date slicer. 

For example, If I choose Feb 2022 in slicer, for user 2 the % should be 100% as he had only one activity in february and it is aligned with the activity type

Any approach for this problem will be extremely helpful.

 

Cheers,

Praj

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.