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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
hallang
Frequent Visitor

Showing count of new start employees by month

Hi,

I am trying to add a 'card' to show the number of new start employees in any current month.  I ahve copied a formula from google but it doesnt seem to be working -

New Start Employee Count =
VAR CurrentMonthStart = STARTOFMONTH(TODAY())
VAR CurrentMonthEnd = ENDOFMONTH(TODAY())
RETURN
CALCULATE(
    COUNTROWS(Sheet1),
    Sheet1[start date ] >= CurrentMonthStart,
    Sheet1[start date ] <= CurrentMonthEnd
)
 
Can anyone suggest how I can do this?
1 ACCEPTED SOLUTION
BenjaminSNN
Frequent Visitor

Hey!

I think STARTOFMONTH() and ENDOFMONTH() can only be used in a table context. You should use EOMONTH(). 
I've altered the code for you:

New Start Employee Count =
VAR CurrentMonthStart = EOMONTH(TODAY(), -1) + 1 // End of last month plus one day is first of this month
VAR CurrentMonthEnd = EOMONTH(TODAY(), 0)

RETURN
CALCULATE(
    COUNTROWS(Sheet1),
    Sheet1[start date ] >= CurrentMonthStart,
    Sheet1[start date ] <= CurrentMonthEnd
)

View solution in original post

2 REPLIES 2
BenjaminSNN
Frequent Visitor

Hey!

I think STARTOFMONTH() and ENDOFMONTH() can only be used in a table context. You should use EOMONTH(). 
I've altered the code for you:

New Start Employee Count =
VAR CurrentMonthStart = EOMONTH(TODAY(), -1) + 1 // End of last month plus one day is first of this month
VAR CurrentMonthEnd = EOMONTH(TODAY(), 0)

RETURN
CALCULATE(
    COUNTROWS(Sheet1),
    Sheet1[start date ] >= CurrentMonthStart,
    Sheet1[start date ] <= CurrentMonthEnd
)

Hi!

 

That seems to work perfectly! Thank you so much!!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors