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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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

Top Solution Authors
Top Kudoed Authors