Forum Discussion

rogelep's avatar
rogelep
Regular Visitor
3 months ago
Solved

Using SelectedValue in measure for computing volume

Hello,   Need help in setting up a measure that counts the number of rows that have a date that is selected in a slicer. I used these measures: SelectedDate = selectedvalue('Complaints Raw Data'[...
  • cengizhanarslan's avatar
    3 months ago

    The fix is to move the SELECTEDVALUE inside the measure using a VAR:

    Volume =
    VAR _SelectedDate =
        SELECTEDVALUE ( 'Complaints Raw Data'[Date Received] )
    RETURN
        CALCULATE (
            COUNT ( 'Complaints Raw Data'[short_id] ),
            'Complaints Raw Data'[Date Received] = _SelectedDate
        )
  • Ashish_Mathur's avatar
    3 months ago

    Hi,

    Create a Calendar table and have a *:1 relationship from the Date received column to the Calendar table.  To your slicer, drag the Date from the Calendar table.  Write this measure

    Volume = count('Complaints Raw Data'[short_id])

    Hope this helps.