March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
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:
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:
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:
How can I achieve this? Thanks in advance!
@Anonymous , 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?
@Anonymous - First thing I would do is unpivot your week columns, it will make your DAX far, far easier.
@Greg_DecklerThanks! Problem is I'm using the live connection (SQL) database mode. Is there an other way to do this?
@Anonymous - 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-p/391698#M129
Or it might be a measure totals problem -
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907
Hard to tell
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
19 | |
19 | |
16 | |
8 | |
5 |
User | Count |
---|---|
36 | |
28 | |
16 | |
16 | |
12 |