1
votes

I got help to the code below to create a measure in PowerPivot, but I'm running into errors because of SELECTEDVALUE which does not seem like a command I can use in Excel, anyone can help me around with this?

VAR SignUpMonth =
    SELECTEDVALUE ( Table1[Signup month] )
VAR MonthDiff =
    SELECTEDVALUE ( '1 through 24'[Value] )
RETURN
    DIVIDE (
        CALCULATE (
            SUM ( [conversion to KYC completed] ),
            FILTER ( Table1, Table1[Month Diff] = MonthDiff )
        ),
        CALCULATE (
            SUM ( Table1[ signups] ),
            FILTER ( ALL ( Table1 ), Table1[Signup month] = SignUpMonth )
        ),
        BLANK ()
    )
1

1 Answers

3
votes

The DAX function SELECTEDVALUE is a newer one that isn't supported in Excel yet, but the documentation linked gives an alternative that works the same way:

An equivalent expression for SELECTEDVALUE(<columnName>, <alternateResult>) is IF(HASONEVALUE(<columnName>), VALUES(<columnName>), <alternateResult>).

You can often just use MAX instead of SELECTEDVALUE if you don't need to return an alternateResult when there is more than one value to choose from.