Forum Discussion
Slicer value which filters comma separated data - Matrix Report
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 .
13 Replies
- Fowmy
Super User
PowerBITesting
Can you try this measure, you select multiple codes as wellmeasureFilterActivity = 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 🙂
?
- PowerBITesting
Helper IV
HI Fowmy I have added your measure but no success.
I have attched my PBIX file in another reply.
- Fowmy
Super User
I checked it, your initial question and the PBIX files do not match.
Can explain exactly what you need to resolve?
- AnonymousNot applicable
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
- PowerBITesting
Helper IV
Hi Anonymous ,
I have followed the same steps but no success, Might be I am doing wrong .
Attaching Power Bi file below.
- amitchandak
Super User
PowerBITesting , Try like
measureFilterActivity = VAR selectedActivity = SELECTEDVALUE('Activity Type'[ID]) return CALCULATE([measure_Total], Filter(All(Account), Account[Activity Type], selectedActivity ))