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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
daxismyproblem
New Member

Count of rows based on slicer selection but ignoring relationship

Hi All,
I have tried to simplify the data model with these two tables.
The first table is the Recognition Table with data as below

daxismyproblem_0-1702954376938.png


The second table is the Employee table as below:

daxismyproblem_1-1702954426679.png

The two tables are connected by a 1:* relationship between Employee ID and Recipient ID. One employee may receive multiple recognitions and it is possible that someone does not receive any. In this case, that employee will be only in the employee table
The visual I am working on is something like this. This is when there are no slicers selected

daxismyproblem_2-1702954526786.png

The dashboard has a number of slicers. For example, the Leader Name and Department Name are slicers. When nothing is selected, the expectation is to get all rows in the Employee table. In this case, 20. 
When we select Leader 'ABC' in the slicer, the visual should change to something like below. 

daxismyproblem_3-1702954749826.png

 

I am not able to get 4 as the # Employees when I use the slicer. I get total number of employees who have received a recognition but not the total number of employees based on the slicer selection.
Any suggestions on how to achieve this?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @daxismyproblem ,

 

Here are the steps you can follow:

1. Create calculated table.

Table =
DISTINCT('Employee Table'[Leader Name])

vyangliumsft_0-1704177242314.png

2. Create measure.

of recongnitions =
var _select=SELECTEDVALUE('Table'[Leader Name])
var _column=SELECTCOLUMNS(FILTER(ALL('Employee Table'),'Employee Table'[Leader Name]=_select),"ID",[Leader ID])
var _count=
COUNTX(
    FILTER(ALL('Reognition Table'),
    'Reognition Table'[Category]=MAX('Reognition Table'[Category])&&'Reognition Table'[Learder ID] in _column),[Recipient ID])
return
IF(
    _count=BLANK(),0,_count)
# Employees =
var _select=SELECTEDVALUE('Table'[Leader Name])
var _column=SELECTCOLUMNS(FILTER(ALL('Employee Table'),'Employee Table'[Leader Name]=_select),"ID",[Leader ID])
return
COUNTX(
    FILTER(ALLSELECTED('Employee Table'),'Employee Table'[Leader ID] in _column),[Employee ID])

3. Result:

vyangliumsft_1-1704177242316.png

 

 

Best Regards,

Liu Yang

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
Anonymous
Not applicable

Hi  @daxismyproblem ,

 

Here are the steps you can follow:

1. Create calculated table.

Table =
DISTINCT('Employee Table'[Leader Name])

vyangliumsft_0-1704177242314.png

2. Create measure.

of recongnitions =
var _select=SELECTEDVALUE('Table'[Leader Name])
var _column=SELECTCOLUMNS(FILTER(ALL('Employee Table'),'Employee Table'[Leader Name]=_select),"ID",[Leader ID])
var _count=
COUNTX(
    FILTER(ALL('Reognition Table'),
    'Reognition Table'[Category]=MAX('Reognition Table'[Category])&&'Reognition Table'[Learder ID] in _column),[Recipient ID])
return
IF(
    _count=BLANK(),0,_count)
# Employees =
var _select=SELECTEDVALUE('Table'[Leader Name])
var _column=SELECTCOLUMNS(FILTER(ALL('Employee Table'),'Employee Table'[Leader Name]=_select),"ID",[Leader ID])
return
COUNTX(
    FILTER(ALLSELECTED('Employee Table'),'Employee Table'[Leader ID] in _column),[Employee ID])

3. Result:

vyangliumsft_1-1704177242316.png

 

 

Best Regards,

Liu Yang

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

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors