Forum Discussion
Using SelectedValue in measure for computing volume
- 4 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 ) - 4 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.
Hi rogelep,
Try below DAX
Volume =
VAR SelectedDt =
SELECTEDVALUE(
'Complaints Raw Data'[Date Received]
)
RETURN
CALCULATE(
COUNT('Complaints Raw Data'[short_id]),
FILTER(
ALL('Complaints Raw Data'),
'Complaints Raw Data'[Date Received] = SelectedDt
)
)
OR
Volume =
VAR SelectedDt =
SELECTEDVALUE(
'Complaints Raw Data'[Date Received]
)
RETURN
CALCULATE(
COUNT('Complaints Raw Data'[short_id]),
TREATAS(
{SelectedDt},
'Complaints Raw Data'[Date Received]
)
)
🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
💡 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
🎖 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
🔗 Curious to explore more? [Discover here].
Let’s keep building smarter solutions together!