Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
rogelep
New Member

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'[Date Received]) //to store the date selected in the measure

Volume = calculate(count('Complaints Raw Data'[short_id]),'Complaints Raw Data'[Date Received] = [SelectedDate]) //should count number of rows that have the same date as the selected date in the slicer
 
However, i'm getting the error message "A function 'PLACEHOLDER' has been used in a True/False expression that is used as a table filter expression. This is not allowed."
 Any clarification or tips on this matter would be highly appreciated.
5 REPLIES 5
Ashish_Mathur
Super User
Super User

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.

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
cengizhanarslan
Super User
Super User

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
    )
_________________________________________________________
If this helped, ✓ Mark as Solution | Kudos appreciated
Connect on LinkedIn | Follow on Medium
AI-assisted tools are used solely for wording support. All conclusions are independently reviewed.
danextian
Super User
Super User

Hi @rogelep 

Why do you need to use a filtered measure when you're using the same column from the same table? You could simply use 'Complaints Raw Data'[Date Received] in a slicer and count('Complaints Raw Data'[short_id]) in a measure.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
grazitti_sapna
Super User
Super User

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!

Rahul_Vyas
New Member

Hi,

The error occurs because CALCULATE's filter arguments must be Boolean column expressions or table expressions — you cannot directly reference a measure (like [SelectedDate]) inside a filter predicate. DAX doesn't allow Column = Measure as a direct filter argument.

Volume =
CALCULATE(
COUNT('Complaints Raw Data'[short_id]),
FILTER(
'Complaints Raw Data',
'Complaints Raw Data'[Date Received] = [SelectedDate]
)
)
====
FILTER() returns a table, which CALCULATE accepts. Inside FILTER, the row-by-row evaluation resolves the measure correctly.

Hope this gets you moving in the right direction! If it solved your problem, hitting 'Mark as Solution' helps others find the answer faster. Kudos are always appreciated too — they go a long way in keeping this community thriving.

I'm always happy to help. Don't hesitate to reach out if you have more questions!

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon & SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.