Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi all,
I have the below measure which I am using to calculate whether staff movement is 'In' or 'Out'. It should show 'In' where there are two instatnces of one name in the filter view and 'Out' if a name only appears once. This measure needs to be dynamic so that the value of 'In' or 'Out' changes depending on the filters applied.
The below works correctly.
New Column =
var thisName = SELECTEDVALUE(Table1[Name])
var nameCount = COUNTROWS(FILTER(ALLSELECTED(Table1), [Name] = thisName))
var result = IF(nameCount > 1, "In", "Out")
return IF(ISINSCOPE('Table1'[Name]), result)
I would now like to edit this measure so that the calculation only spits out 'In' or 'Out' where the value in the column 'Department' is 'Sales' or 'Marketing'. All otehr departments should be blank.
Here is an example of my data:
Table1 (no filters) John shows as 'In' in the new column as his name appears twice.
John | Sales | In |
John | Marketing | In |
Julie | Marketing | Out |
Jake | Sales | Out |
Simon | IT |
If you then filter Department to show just Marketing (using a slicer on the same page), I would like John to change to 'Out' as there is now only one occurrence of the name John.
John | Marketing | Out |
Julie | Marketing | Out |
Solved! Go to Solution.
Hi @JadeM ,
1.The measure can be modified to:
New Column =
var thisName = SELECTEDVALUE('Table'[Name])
var nameCount = COUNTROWS(FILTER(ALLSELECTED('Table'), [Name] = thisName))
var result =
IF(SELECTEDVALUE('Table'[Department]) = "Marketing" || SELECTEDVALUE('Table'[Department]) = "Sales",
IF(nameCount > 1, "In", "Out"),BLANK())
return IF(ISINSCOPE('Table'[Name]), result)
2.Set the Name or Department field to show items with no data so that when there is no data in the New Column column, the other columns can still be displayed normally.
The results obtained are shown below:
If your Current Period does not refer to this, please clarify in a follow-up reply.
Best Regards,
Clara Gong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @JadeM ,
1.The measure can be modified to:
New Column =
var thisName = SELECTEDVALUE('Table'[Name])
var nameCount = COUNTROWS(FILTER(ALLSELECTED('Table'), [Name] = thisName))
var result =
IF(SELECTEDVALUE('Table'[Department]) = "Marketing" || SELECTEDVALUE('Table'[Department]) = "Sales",
IF(nameCount > 1, "In", "Out"),BLANK())
return IF(ISINSCOPE('Table'[Name]), result)
2.Set the Name or Department field to show items with no data so that when there is no data in the New Column column, the other columns can still be displayed normally.
The results obtained are shown below:
If your Current Period does not refer to this, please clarify in a follow-up reply.
Best Regards,
Clara Gong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@JadeM Maybe:
New Column =
var thisName = SELECTEDVALUE(Table1[Name])
var thisDept = SELECTEDVALUE(Table1[Department])
var nameCount = COUNTROWS(FILTER(ALLSELECTED(Table1), [Name] = thisName))
var result = SWITCH(TRUE(), thisDept = BLANK(), BLANK(), nameCount > 1, "In", "Out")
return IF(ISINSCOPE('Table1'[Name]), result)