Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin 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.
I cant spilts the Account ( activty type ) column as there is relationship constriant is there.
I have added Slicer as Activity Type Table which shows colour . How I can filter the Account table for the Slicer with If (Contains) value.
I was trying something like
measureFilterActivity =
VAR selectedActivity = SELECTEDVALUE('Activity Type'[ID])
return
CALCULATE([measure_Total],
Filter(All(Account),
SEARCH(100, Account[Activity Type],,BLANK())>0
|| SEARCH(101, Account[Activity Type],,BLANK())>0 ........
))
But this dint worked for me .
Hi @PowerBITesting ,
According to my understanding, you want to calculate the total when the value of Activity Type contains slicer’s selected value, right?
You could use the following formula:
totalMeasure =
VAR _selected =
SELECTEDVALUE ( 'Activity Type'[ID] )
RETURN
IF (
CONTAINSSTRING ( SELECTEDVALUE ( Account[Activity Type] ), _selected ),
1,
0
)// Apply Conditional formatting
backColor =
VAR _selected =
SELECTEDVALUE ( 'Activity Type'[ID] )
VAR _selectedColor =
CALCULATE (
SELECTEDVALUE ( 'Activity Type'[Color] ),
FILTER ( ALL ( 'Activity Type' ), 'Activity Type'[ID] = _selected )
)
RETURN
IF (
CONTAINSSTRING ( SELECTEDVALUE ( Account[Activity Type] ), _selected ),
_selectedColor,
"White"
)My visualization looks like this:
Is the result what you want? If you have any questions, please upload some data samples and expected output.
Please do mask sensitive data before uploading.
Best Regards,
Eyelyn Qin
Hi @Anonymous ,
I have followed the same steps but no success, Might be I am doing wrong .
Attaching Power Bi file below.
@PowerBITesting , Try like
measureFilterActivity =
VAR selectedActivity = SELECTEDVALUE('Activity Type'[ID])
return
CALCULATE([measure_Total],
Filter(All(Account), Account[Activity Type], selectedActivity
))
@PowerBITesting
Can you try this measure, you select multiple codes as well
measureFilterActivity =
VAR selectedActivity = ALLSELECTED(Activity[Code])
var _sum =
SUMX(
VALUES(Accounts[Activity Type]),
IF(
COUNTROWS(
FILTER(
selectedActivity,
SEARCH(Activity[Code],Accounts[Activity Type],,0) > 0
)
) >0, CALCULATE(SUM(Accounts[Value]))
)
)
RETURN
_sum
________________________
Did I answer your question? Mark this post as a solution, this will help others!.
Click on the Thumbs-Up icon if you like this reply 🙂
?
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
HI @Fowmy I have added your measure but no success.
I have attched my PBIX file in another reply.
Please try this expression. It should work with multiple selections on the Color slicer (with no relationship between the tables).
Color Filter Count =
SUMX (
VALUES ( Color[Activity Type Code] ),
VAR thiscode = Color[Activity Type Code]
RETURN
COUNTROWS (
FILTER ( Activity, SEARCH ( thiscode, Activity[Activity Type],, 0 ) > 0 )
)
)
Also, is the relationship between the Account ID and Activity ID correct? The activity appears to just be an index column.
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
I checked it, your initial question and the PBIX files do not match.
Can explain exactly what you need to resolve?
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Hi @Fowmy Account and Activity are 1:N related. Matrix shows account name , Created on date from activity, group by month/year. which shows the count of activity types(count color codes) for the respective account and activity( month/year -created on date from activity).
If I add a filter with contains that worked for me but I need same thing slicer should do.
I need to filter by Color (only those activities) and total should be updated based on the Filter?
Download this copy( rectified few data sets).
Did you try the measure I suggested? It return the same values as your example when White is selected (Activity = 100).
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
I reopened your original file and just added the measure (to make sure I didn't do anything else too), and it worked the same. I removed the count you had there and added the new measure, filtered on White and it worked. Not sure why didn't work for you.
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Perfect ! let me test in my desired data set and update you
One more thing If I dint select any slicer value value count is wrong?
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 76 | |
| 37 | |
| 31 | |
| 27 | |
| 27 |