arguments in generate series cannot be blank error

Viewed 21

i am trying to apply levenshtein distance to 2 columns, tables and getting error in generate series cannot be blank.Here is my code.

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 )
1 Answers

With a little effort you could have figured this out yourself:

  1. The error message tells you that one of the parameters of GENERATESERIES() is blank. This can ONLY be the length variable.

  2. length is blank when both variables SlicerText and TableText are blank.

  3. both variables refer to the SELECTEDVALUE() function, which returns blank if none or more than one rows are selected and you didn't provide an alternateResult, see the official documentation here: SELECTEDVALUE

Bottom line: Make shure you have exactly one row selectd in 'Slicer Table' and 'Table'.

This is as much help as you can get, since you didn't share a minimal, reproducible example as recommended by StackOverflow.

Related