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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Summarize with countX

I have a table(Table A) with following fields

 

VarId     CaseId    Activity

 

This table is linked to another table(Table B) on CaseId. Now I need to create a calculated table which should contain following fields:

 

Var Id         Activity       TotalCount

 

So this calculated table will contain total count of each activity per variant.

 

Also, selecting a VarId in a table visual , should update this calculated table to show the count of activities only for selected VarId (there can be multiple selection too). I have used below DAX query to create the table.

 

VarAndActivityCount =
SUMMARIZE('TableA', TableA[Var Id], TableA[Activity], "TotalCount", Countx(TableA,IF(CONTAINS(ALLSELECTED(TableB[Var Id]),TableB[Var Id],TableA[Var Id]),1,0)))
 

It is giving correct count for each activity when all var Ids are selected but when I select few var ids, number is not matching with the expected count 

 

Can anyone please help me to resolve this issue.                        

2 REPLIES 2
Thejeswar
Super User
Super User

Hi @Anonymous ,

I tried replicating your issue with some sample data I made. Found it was working as expected.

 

On a high level, May be, what you can check is the data type of the coumn Var Id and also if there are any reationships built based on Var Id Column.

 

These two might affect the way it works.

 

For more detailed clarification, you might have to share some sample data. If possible, PBIX file

 

Cheers!

v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous ,

To understand your scenario better, you'd better show some data sample which could reproduce your scenario and your desired output so that we could help further on it.

Or, ideally, share the pbix (beware of confidential data).

Best  Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

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

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.