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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
snehar
Frequent Visitor

how to calculate no of days in each month between startdate and enddate

Hi everybody I am newbie with DAX.

I have a vacation table, with startdate, enddate and employee id. I need to calculate no of days in each month(if start date and endate are two different months)
for example
id  start_date   end_date
10 17/05/2023 12/06/2023
I need to know howmany days in may and june separately
Any help would be much appreciated. Thanks all!

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Please find attached my PBI file.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

7 REPLIES 7
snehar
Frequent Visitor

hey , is it possible to get no of days in each month between startdate and enddate, as a new column in the same table?

snehar_0-1690239829204.png

 

 

No, it is not.  If the start and end dates span multiple months then one rows for each day should be created.  You cannot create a row in a Table.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

if there is multiple months like the screenshot i shared, of diiferent employees (startdate and enddate of vactaion taken of each employee)how do i get no of days in each month 

The only way i am aware of is to transform the data in the Query Editor (I have already shared that file with you)


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
snehar
Frequent Visitor

snehar_0-1690271222048.png

 

Ashish_Mathur
Super User
Super User

Hi,

Please find attached my PBI file.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Total_Days=DateDiff(Min(Start_Date) , Max(End_Date),Day)

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.