The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi there
The following calculated column Dax Formula works; however, the equivalent as a Measure only produces 4's and not the correct values (0 and 2) based on selected dates:
Background:
I need to calculate the capacity (number of jobs) employees can do per day based on the below date criteria:
Startdate = Employee start date
TermDate = Employ Termination date
2JobCapDate = The date from when the employee can manage 2 jobs per day
4JobCapDate = The date from when the employee can manage 4 jobs per day
Logic:
If the startdate column date is before the selected date and
the Termdate column date is blank and
the selected date is not a weekday or a bankholiday,
then let the value be 0, if the selected date is before the 2JobCapDate column date, or
let the value be 2 if the selected date is after the 2JobCapDate column date but before the 4JobCapDate or
let the value be 4 if the selected is on or after the 4JobCapDate column date.
Calculated Column (each column is named a specific date, example 1-Feb-2025):
Solved! Go to Solution.
in my example it is done in the visual itself. But if you want you can create one in DAX too, via CROSSJOIN(). Note that I cheaped out and do not show row totals. If you need those then you need to implement the full cross join experience.
Hi There
Here is a test model with data table and measure created:
https://www.dropbox.com/scl/fi/kj10u9t9dqzrm89ngznl6/Test-Capacity-Planner.pbix?rlkey=8g0p0urnbruqpr...
Background:
I need to calculate the capacity (number of jobs) employees can do per day based on the below date criteria:
Startdate = Employee start date
TermDate = Employ Termination date
2JobCapDate = The date from when the employee can manage 2 jobs per day
4JobCapDate = The date from when the employee can manage 4 jobs per day
Logic:
If the startdate column date is before the selected date and
the Termdate column date is blank and
the selected date is not a weekday or a bankholiday,
then let the value be 0, if the selected date is before the 2JobCapDate column date, or
let the value be 2 if the selected date is after the 2JobCapDate column date but before the 4JobCapDate or
let the value be 4 if the selected is on or after the 4JobCapDate column date.
Hope this helps.
Thanks Regs Andre
The bankholiday column has no usable data, so I'll go with the IsBusinessDay column.
You need to disconnect the date table (i did it by deactivating the relationship).
Then create a cross join between calendar dates and employees.
and then implement the date logic.
Hi Ibendlin.
Looks great thanks!
I've followed your instructions.
The only thing that I'm unsure about is creating the cross join.
Would I do this in the query?
Thanks
Regs
Andre
in my example it is done in the visual itself. But if you want you can create one in DAX too, via CROSSJOIN(). Note that I cheaped out and do not show row totals. If you need those then you need to implement the full cross join experience.
Thanks so much; you're a rockstar!
You provided a wall of code without context. That makes it difficult to help.
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.
Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...
User | Count |
---|---|
15 | |
8 | |
6 | |
6 | |
6 |
User | Count |
---|---|
23 | |
14 | |
13 | |
8 | |
8 |