cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Casperserven1
New Member

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
yingyinr
Community Support
Community Support

Hi @Casperserven1 ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want.

You can create a holiday table with these holiday date(20/12/2021,27/12/2021...) first.

yingyinr_0-1656407610577.png

Then update the formula of your measure as below(the part with red font is updated one):

1_EmployeeCount =
CALCULATE (
    SUM ( CumulativeData[Person Count] ),
    FILTER (
        'CalCumulative',
        NOT ( 'CalCumulative'[WeekStarting] IN VALUES ( 'Holidays'[Holidays] )
    ),
    FILTER (
        CumulativeData,
        CumulativeData[Employee Type] IN { "Employee", "Ex-employee" }
    )
)

yingyinr_1-1656408129722.pngIf you don't want to create any holiday table, you can update the formula of your measure as below. One problem here is that it's not easy to maintain later, if new holiday dates are added or changed, you need to find the related measures first before modifying 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" )
            }
    ),
    FILTER (
        CumulativeData,
        CumulativeData[Employee Type] IN { "Employee", "Ex-employee" }
    )
)

Best Regards

Community Support Team _ Rena
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

2 REPLIES 2
yingyinr
Community Support
Community Support

Hi @Casperserven1 ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want.

You can create a holiday table with these holiday date(20/12/2021,27/12/2021...) first.

yingyinr_0-1656407610577.png

Then update the formula of your measure as below(the part with red font is updated one):

1_EmployeeCount =
CALCULATE (
    SUM ( CumulativeData[Person Count] ),
    FILTER (
        'CalCumulative',
        NOT ( 'CalCumulative'[WeekStarting] IN VALUES ( 'Holidays'[Holidays] )
    ),
    FILTER (
        CumulativeData,
        CumulativeData[Employee Type] IN { "Employee", "Ex-employee" }
    )
)

yingyinr_1-1656408129722.pngIf you don't want to create any holiday table, you can update the formula of your measure as below. One problem here is that it's not easy to maintain later, if new holiday dates are added or changed, you need to find the related measures first before modifying 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" )
            }
    ),
    FILTER (
        CumulativeData,
        CumulativeData[Employee Type] IN { "Employee", "Ex-employee" }
    )
)

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
sathya_s
Frequent Visitor

Hi @Casperserven1

Is there any pattern/logic in the mentioned dates. Are you calculating the expression for filtering out just weekends or are there specific dates that are holidays.

Helpful resources

Announcements
August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power BI Dev Camp Session 24 without aka link and time 768x460.jpg

Ted's Dev Camp - July 28, 2022

Watch Session 24 of Ted's Dev Camp along with past sessions!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors