Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreShape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.
Hello PowerBI users
I'm wanting to use an OR function... ,not sure how to do it... here's the measure:
Solved! Go to Solution.
Hi there. Your formula does not adhere to Best Practices and hence may not be as fast as possible. Here's an optimized version:
TotalBooked =
CALCULATE(
COUNT('Session Report'[Session Attendance]),
KEEPFILTERS(
TREATAS(
{"Booked", "Attended"},
'Session Report'[Session Attendance]
)
)
)
@rayinOz You can use this:
TotalBooked =
CALCULATE (
COUNT ( 'Session Report'[Session Attendance] ),
KEEPFILTERS ( 'Session Report'[Session Attendance] = "Booked"
|| 'Session Report'[Session Attendance] = "Attended" )
)
Or
TotalBooked =
CALCULATE (
COUNT ( 'Session Report'[Session Attendance] ),
KEEPFILTERS ( 'Session Report'[Session Attendance] IN { "Booked", "Attended" } )
)
@rayinOz You can use this:
TotalBooked =
CALCULATE (
COUNT ( 'Session Report'[Session Attendance] ),
KEEPFILTERS ( 'Session Report'[Session Attendance] = "Booked"
|| 'Session Report'[Session Attendance] = "Attended" )
)
Or
TotalBooked =
CALCULATE (
COUNT ( 'Session Report'[Session Attendance] ),
KEEPFILTERS ( 'Session Report'[Session Attendance] IN { "Booked", "Attended" } )
)
Hi there. Your formula does not adhere to Best Practices and hence may not be as fast as possible. Here's an optimized version:
TotalBooked =
CALCULATE(
COUNT('Session Report'[Session Attendance]),
KEEPFILTERS(
TREATAS(
{"Booked", "Attended"},
'Session Report'[Session Attendance]
)
)
)
Hi Daxer! Thanks so much for this, it worked perfectly!
@rayinOz , try like
TotalBooked = CALCULATE(COUNT('Session Report'[Session Attendance]), FILTER('Session Report', 'Session Report'[Session Attendance] in {"Booked" ,"Attended" }))
@rayinOz - Either will work:
TotalBooked = CALCULATE(COUNT('Session Report'[Session Attendance]), FILTER('Session Report', 'Session Report'[Session Attendance]="Booked" || 'Session Report'[Session Attendance]="Attended"))
TotalBooked = CALCULATE(COUNT('Session Report'[Session Attendance]), FILTER('Session Report', OR('Session Report'[Session Attendance]="Booked",'Session Report'[Session Attendance]="Attended")))
User | Count |
---|---|
24 | |
21 | |
19 | |
13 | |
12 |
User | Count |
---|---|
40 | |
28 | |
28 | |
22 | |
21 |