Forum Discussion
Gsar
4 years agoFrequent Visitor
Slicer to Filter Substring
Hey Community! For once again I am in need of your help. I have created a measure that allows me to count the specific number of time slots within a time range and converted it to a visual. L...
- 4 years ago
I assume that you have a very good hang of DAX. I hope you will be able to adapt this my measure to yours.
Basically, you should start by creating a disconnected table that looks like the one below:
Then write a measure that looks like the below:
Row Count =VAR SelectedUniqueProduct =SELECTEDVALUE ( 'Product'[Unique Product] )VAR ContainSelection =FILTER (ALL ( 'Table'[Product] ),CONTAINSSTRING ( 'Table'[Product], SelectedUniqueProduct ))RETURNCALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Product] IN ContainSelection )My result looks like the below:If this works for you, kindly mark as solution to allow other community members who may have similar challenges find solutions quickly. - 4 years ago
If I understand the ask correctly, when you select Beef, Cheese, Meat, the measure should respectively give you 5,3,5.
You can use a measure like this
Measure = VAR _1 = ADDCOLUMNS ( 'Table', "newString", SUBSTITUTE ( 'Table'[Product], ",", "|" ) ) VAR _2 = GENERATE ( _1, ADDCOLUMNS ( GENERATESERIES ( 1, PATHLENGTH ( [newString] ) ), "splitString", TRIM ( PATHITEM ( [newString], [Value], TEXT ) ) ) ) RETURN COUNTX ( FILTER ( _2, [splitString] = SELECTEDVALUE ( 'ProductSlicer'[Product] ) ), [splitString] )
ahmedoye
4 years agoResponsive Resident
I assume that you have a very good hang of DAX. I hope you will be able to adapt this my measure to yours.
Basically, you should start by creating a disconnected table that looks like the one below:
Then write a measure that looks like the below:
Row Count =
VAR SelectedUniqueProduct =
SELECTEDVALUE ( 'Product'[Unique Product] )
VAR ContainSelection =
FILTER (
ALL ( 'Table'[Product] ),
CONTAINSSTRING ( 'Table'[Product], SelectedUniqueProduct )
)
RETURN
CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Product] IN ContainSelection )
My result looks like the below:
If this works for you, kindly mark as solution to allow other community members who may have similar challenges find solutions quickly.