Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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 |
---|---|
56 | |
22 | |
19 | |
16 | |
11 |
User | Count |
---|---|
85 | |
54 | |
39 | |
21 | |
18 |