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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Casperserven1
Helper I
Helper I

filter out dates - a better way

is there a better way to do this?

1_EmployeeCount = -- count the number of Employees in filtering out holiday dates
CALCULATE(
SUM( CumulativeData[Person Count] ) ,
FILTER(CalCumulative,CalCumulative[WeekStarting]<> DATEVALUE( "20/12/2021" )),
FILTER( CalCumulative,CalCumulative[WeekStarting]<> DATEVALUE( "27/12/2021" )),
FILTER( CalCumulative,CalCumulative[WeekStarting]<> DATEVALUE( "17/01/2022" )),
FILTER( CalCumulative,CalCumulative[WeekStarting]<> DATEVALUE( "03/05/2021" )),
FILTER( CalCumulative,CalCumulative[WeekStarting]<> DATEVALUE( "31/05/2021" )),
FILTER( CalCumulative,CalCumulative[WeekStarting]<> DATEVALUE( "11/04/2022" )),
FILTER( CalCumulative,CalCumulative[WeekStarting]<> DATEVALUE( "30/08/2021" )),
FILTER( CalCumulative,CalCumulative[WeekStarting]<> DATEVALUE( "18/04/2022" )),
FILTER( CalCumulative,CalCumulative[WeekStarting]<> DATEVALUE( "02/05/2022" )),
FILTER( CalCumulative,CalCumulative[WeekStarting]<> DATEVALUE( "23/05/2022" )),
FILTER( CalCumulative,CalCumulative[WeekStarting]<> DATEVALUE( "03/01/2022" )),
FILTER (CumulativeData,CumulativeData[Employee Type] IN {"Employee","Ex-employee"}
)
)
1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @Casperserven1 ;

You could try it.

1_EmployeeCount =
-- count the number of Employees in filtering out holiday dates
CALCULATE (
    SUM ( CumulativeData[Person Count] ),
    FILTER (
        CalCumulative,
        NOT ( CalCumulative[WeekStarting] )
            IN {
                DATEVALUE ( "20/12/2021" ),
                DATEVALUE ( "27/12/2021" ),
                DATEVALUE ( "17/01/2022" ),
                DATEVALUE ( "03/05/2021" ),
                DATEVALUE ( "31/05/2021" ),
                DATEVALUE ( "11/04/2022" ),
                DATEVALUE ( "30/08/2021" ),
                DATEVALUE ( "18/04/2022" ),
                DATEVALUE ( "02/05/2022" ),
                DATEVALUE ( "23/05/2022" ),
                DATEVALUE ( "03/01/2022" )
            }
                && CumulativeData[Employee Type] IN { "Employee", "Ex-employee" }
    )
)

and if you have more logic about datevalue, could you share it?


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-yalanwu-msft
Community Support
Community Support

Hi, @Casperserven1 ;

You could try it.

1_EmployeeCount =
-- count the number of Employees in filtering out holiday dates
CALCULATE (
    SUM ( CumulativeData[Person Count] ),
    FILTER (
        CalCumulative,
        NOT ( CalCumulative[WeekStarting] )
            IN {
                DATEVALUE ( "20/12/2021" ),
                DATEVALUE ( "27/12/2021" ),
                DATEVALUE ( "17/01/2022" ),
                DATEVALUE ( "03/05/2021" ),
                DATEVALUE ( "31/05/2021" ),
                DATEVALUE ( "11/04/2022" ),
                DATEVALUE ( "30/08/2021" ),
                DATEVALUE ( "18/04/2022" ),
                DATEVALUE ( "02/05/2022" ),
                DATEVALUE ( "23/05/2022" ),
                DATEVALUE ( "03/01/2022" )
            }
                && CumulativeData[Employee Type] IN { "Employee", "Ex-employee" }
    )
)

and if you have more logic about datevalue, could you share it?


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.