Forum Discussion
Using SelectedValue in measure for computing volume
- 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 ) - 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.
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!