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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
janszoon
Frequent Visitor

Available days per week (planning)

Hi all,

 

I'm new to the all the DAX formula. And i'm struggeling to find the solution. I want to get the hours available for each consultant grouped by weeks. Like this:

janszoon_0-1597677229811.png

 

Each day (except weekend) the consultants are able to make 8 hours. The consultants want to be able to see which weeks they have room voor new projects. When 8 hours are already planned on a specific day, they have no space left. The planning is recorded in the table Workorder. The days available have to be totaled per week. Unfortunately, I cannot assume that a consultant has 40 hours a week deducted by the planned hours that week. This is because, it is possible that consultant is planned twice in one day (more than 8 hours).

 

I made the following formula thanks to the Forum. But unfortunately it doesn't work properly as you can see. Per date the available hours are correct, but when totaled per week it doesn't work. See below the formula:

 

janszoon_1-1597683692065.png

The table factworkorder[DurationTime] contains the amount of hours planned per date. It is possible that on a specific date there are no hours planned, so the available hours have to be 8 (1 day). Below the outcome of the formula above:

 

janszoon_3-1597683909090.png

How can I achieve this? Thanks in advance!

7 REPLIES 7
Anonymous
Not applicable

You can also use the composite model and you'll most likely be able to create any table you want and take data from any source you want.

https://docs.microsoft.com/en-us/power-bi/transform-model/desktop-composite-models
Anonymous
Not applicable

Yeah. If you use SQL live connection you can approach your SQL admin and politely ask him to create a view for you with the unpivoted data. It's dead simple to do and you'll be having a much more pleasant time with DAX.
amitchandak
Super User
Super User

@janszoon , You have unpivot the data and you join with date table having week number to get dates. That can have the standard hours per day too.

https://radacad.com/pivot-and-unpivot-with-power-bi

Can you share sample data and sample output in a table format?

@amitchandak  Thanks! Problem is I'm using the live connection (SQL) database mode. Is there an other way to do this? To deduct the planned hours of the 8 hours per day?

Greg_Deckler
Super User
Super User

@janszoon - First thing I would do is unpivot your week columns, it will make your DAX far, far easier.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

@Greg_DecklerThanks! Problem is I'm using the live connection (SQL) database mode. Is there an other way to do this?

@janszoon - OK, what does your source data look like? I can think of a couple possible things that could help but I need to understand the format of the source data. 

 

For example, this might be a situation for multi-column aggregation. https://community.powerbi.com/t5/Quick-Measures-Gallery/Multi-Column-Aggregations-MC-Aggregations/m-...

 

Or it might be a measure totals problem - 
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

https://community.powerbi.com/t5/Quick-Measures-Gallery/Matrix-Measure-Total-Triple-Threat-Rock-amp-...

 

Hard to tell


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors