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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
chandni90
Frequent Visitor

Previous Month Function- DAX

Hi,

I have a dataset with names and the hiring dates. I also have a calendar table. I am trying to simply find the number of people who joined last month by using the previous month function. However, the previous month funtion is not returning any value. Please help to solve this. Thanks!

 

cc.PNG

 

cc.PNG

 

cc.PNG

Previous month head count = CALCULATE(COUNT(Sheet1[Name]),PREVIOUSMONTH('Sheet1 (2)'[CalendarDate]))
3 REPLIES 3
Anonymous
Not applicable

First, your tables are BADLY NAMED. Good naming is of paramount importance in any programming activity.

Secord, your formula doesn't work because you should always check what arguments a function takes.

Please see: www.daxguide.com/count

Best
D.

This is dummy data. The count function works fine when I calculate the total head count.

Anonymous
Not applicable

PREVIOUSMONTH -> Returns a table that contains a column of all dates from the previous month, based on the first date in the dates column, in the current context.

This might be the cause of your problem. The above function works OK when used on a day or a month level. Anything of lower granularity and you've got a problem.

Best
D.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors