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

Add calculated column from related table which accepts filters on related table

Hi,

I would like to create a calculated column (measure doesn't work since I want to use it in a slicer) where the value is a count of values in a related table. If I were to filter on the related table, the values in the calculated column should be updated. 

 

Example: 

Table A is basically a list of companies we do business with and some of their characteristics. Table B is a list of users working for these companies. Each user (row) in Table B has an assigned user type, let's say Type 1 and Type 2. I want to create a calculated column in Table A that counts the number of users in Table B for each company. This column should be used as a slicer in my report. I also want to create a slicer with user type, so if I select Type 1, the slicer with number of users should be updated such that only users with type 1 is counted. 

 

I have tried COUNTROWS(RELATEDTABLE('Table B')), but if I select Type 1 in my slicer, this still counts both Type 1 and Type 2 users. The relationship between Table A and Table B is "Both", but I have tried with "Single" as well without success. This is really easy with a measure, but the measure cannot be used as a slicer. 

 

Any suggestions?

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @Anonymous ,

Current power bi not support to create dynamic calculated column/table based on slicer/filter. Please use measure to instead.

Calculated Column/Table Change Dynamically According to Slicer Selection in the Report.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help 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.