Forum Discussion
rayinOz
6 years agoHelper III
COUNT and OR statement?
Hello PowerBI users I'm wanting to use an OR function... ,not sure how to do it... here's the measure: TotalBooked = CALCULATE(COUNT('Session Report'[Session Attendance]), FILTER('Session Re...
- Anonymous6 years ago
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] ) ) ) - 6 years ago
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" } ) )
AntrikshSharma
6 years agoCommunity Champion
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" } )
)