Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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")))
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
43 | |
23 | |
21 | |
15 | |
15 |
User | Count |
---|---|
45 | |
31 | |
30 | |
18 | |
17 |