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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Resident Rockstar
Resident Rockstar

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.