Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Using Selected Value when 2 Years are selected in Filter?

I have a table like this:

I have a slicer.

As long as I keep the slicer to single select, this Measure retrieves the correct result:

Measure = calculate(

                                   sum(DateDimension[Denominator]),
                                           FILTER(DateDimension,DateDimension[Date]<=
                                                      Calculate(
                                                                      MAX(NumberTable[EOMonth].[Date]),
                                                                     Filter(NumberTable,NumberTable[CalendarYear]                     
                                                                     =SELECTEDVALUE(DateDimension[Year]))
                                                                              )
                                                 ))

 

But I want to change it so that if the slicer is All or multiple years, it will still work:

What am I missing?

TYIA.

  • Anonymous You can't use SELECTEDVALUE when there is more than one value, otherwise it will return the "alternate result". You need to get the values using VALUES or DISTINCT and use the IN operator.

1 Reply

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Anonymous You can't use SELECTEDVALUE when there is more than one value, otherwise it will return the "alternate result". You need to get the values using VALUES or DISTINCT and use the IN operator.