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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Joshua_
Helper II
Helper II

Get days worked between two dates

Hi Guys,

I need to add a column that shows me the working day of the month, but starting and ending on a specific date,
for example started Jan 10 and ending Jan 25

Sin título.png

I tried to create a column but the result was the total of the days.

NEW COLUMN =
var ini = MIN(CAMPANA[FEC_INICIO])
Var fin = MAX(CAMPANA[FEC_FIN])

return
SUMX(
FILTER(
CALENDARIO,
CALENDARIO[Date]>= ini && CALENDARIO[Date]<= fin
),
CALENDARIO[DIAS_HABILES]
)

I think the DATESMTD function is an option but I can't change the first day of the month.

thank a lot!

1 ACCEPTED SOLUTION

HI @parry2k ,

I created a second table containing the dates of the new table and connected it with my calendar table, then I got the business days (related function) and with the following formula I can do it.

CALCULATE(
SUM(CALENDARIO_CAMPANA[DIAS_HABILES]),
FILTER(
CALENDARIO_CAMPANA,
CALENDARIO_CAMPANA[Date]<=EARLIER(CALENDARIO_CAMPANA[Date]) && CALENDARIO_CAMPANA[CAMPANA] = EARLIER(CALENDARIO_CAMPANA[CAMPANA])
)
)



 

Joshua__0-1642104705140.png

 

View solution in original post

3 REPLIES 3
parry2k
Super User
Super User

@Joshua_ all month start from 10 and ends at 25th? what's the logic?

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hi @parry2k ,

It happens that I need to import a new table to the project and the dates of that data start and end on the 10th of every month, and I need to display the results based on the business days between those periods.

HI @parry2k ,

I created a second table containing the dates of the new table and connected it with my calendar table, then I got the business days (related function) and with the following formula I can do it.

CALCULATE(
SUM(CALENDARIO_CAMPANA[DIAS_HABILES]),
FILTER(
CALENDARIO_CAMPANA,
CALENDARIO_CAMPANA[Date]<=EARLIER(CALENDARIO_CAMPANA[Date]) && CALENDARIO_CAMPANA[CAMPANA] = EARLIER(CALENDARIO_CAMPANA[CAMPANA])
)
)



 

Joshua__0-1642104705140.png

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.