cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
fsim
Responsive Resident
Responsive Resident

start date - end date and sum per month

Hi !
I'm not even sure how to express myself on this problem.

I have one table of tasks, with a start date, an end date, a number of allocated daily hours and an user.
I also have a calendar table.

I want to have an idea of the montly occupation rate of my users knowing that they are supposed to work 8h/day from mon to fri.

I guess I should create some measure that counts for every project/user the number of days between the two dates , then multiply by the number of allocated hours and sum the results on a monthly basis.  Then devided by the numbers of avalaible working hours. (I already have this one !) 
So a specific user, working 4hours a day on one single project that ran from feb 1st to March 1st  should have a 50% occupation rate for february and  2% on March (4h/ 23 working day * 8h)
I tried using datebetween , but I get an error message saying that there are many different start date. I can't figure it out (spent too much time in power query and not enough on Dax :-D)
Could a good soul gives me an hint ?
thanks in advance

1 ACCEPTED SOLUTION
fsim
Responsive Resident
Responsive Resident

Hi Liang,
thanks for your answer.

Obvioulsy, Dax is not the best tool for this. I decided to go back to PowerQuerry and generate a list of date for each reccord. Then I was able to expand the list in new rows. 
List.Dates([start_date],Duration.Days([end_date]-[start_date])+1, #duration(1,0,0,0))
Now I have to deal with repeated dates, but this is another storry

View solution in original post

2 REPLIES 2
fsim
Responsive Resident
Responsive Resident

Hi Liang,
thanks for your answer.

Obvioulsy, Dax is not the best tool for this. I decided to go back to PowerQuerry and generate a list of date for each reccord. Then I was able to expand the list in new rows. 
List.Dates([start_date],Duration.Days([end_date]-[start_date])+1, #duration(1,0,0,0))
Now I have to deal with repeated dates, but this is another storry

V-lianl-msft
Community Support
Community Support

Hi @fsim ,


See if this blog can help you:

https://blog.enterprisedna.co/how-to-calculate-occupancy-days-per-month-in-power-bi-using-dax/ 

If you can provide some sample data and the results you expect,we can do more tests to help you check this issue.


Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors