Forum Discussion
Anonymous
6 years agoNot applicable
Levenshtein String Distance Algorithm In DAX
Hello, So far, this article is the closest I've come to trying to reach a measure that I've been working on for a while... Measure equavalent for string similarity formula I know it can...
- 6 years ago
Hi,
Please try to create a seperate slicer table as the same with your original table first.
Create this column:
Column = LEN('Table'[TestColumn])Then try this measure:
Measure = VAR SlicerText = SELECTEDVALUE ( 'Slicer Table'[TestColumn] ) VAR TableText = SELECTEDVALUE ( 'Table'[TestColumn] ) VAR length = MAX ( LEN ( SlicerText ), LEN ( TableText ) ) VAR TestTable = ADDCOLUMNS ( GENERATESERIES ( 1, length, 1 ), "InSlicer", MID ( SlicerText, [Value], 1 ), "InTable", MID ( TableText, [Value], 1 ) ) RETURN COUNTROWS ( FILTER ( TestTable, [InSlicer] = [InTable] ) ) / COUNTROWS ( TestTable )When you select one value in slicer, the result shows:
Here is my test pbix file:
Hope this helps.
Best Regards,
Giotto Zhi
v-gizhi-msft
Community Support
6 years agoHi,
Please try to create a seperate slicer table as the same with your original table first.
Create this column:
Column = LEN('Table'[TestColumn])Then try this measure:
Measure =
VAR SlicerText =
SELECTEDVALUE ( 'Slicer Table'[TestColumn] )
VAR TableText =
SELECTEDVALUE ( 'Table'[TestColumn] )
VAR length =
MAX ( LEN ( SlicerText ), LEN ( TableText ) )
VAR TestTable =
ADDCOLUMNS (
GENERATESERIES ( 1, length, 1 ),
"InSlicer", MID ( SlicerText, [Value], 1 ),
"InTable", MID ( TableText, [Value], 1 )
)
RETURN
COUNTROWS ( FILTER ( TestTable, [InSlicer] = [InTable] ) )
/ COUNTROWS ( TestTable )When you select one value in slicer, the result shows:
Here is my test pbix file:
Hope this helps.
Best Regards,
Giotto Zhi
mickechi
6 years agoNew Member
Not Found file .pbix for download