Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have a montly target of 1,000 hours and would like to break that down to a daily target that only increases on weekdays (Mon to Friday).
What I've been able to do by myself is break down the 1000 hours into a daily target (1000 hours / # of weekdays in the month) * Current day of the month. Unfortunately, this results in the daily target being too high. The other option I tried was (1000 hours / # of days in the current month) * day of the current month. This resulted in a target which is too low. I'm trying to find a happy "medium" by forcing the sum to rise only on weekdays.
Solved! Go to Solution.
What you want is 1000 hrs * ( # weekdays so far this month ) / ( # weekdays in the month ).
This is easier to calculate if you have an IsWeekday column on your date dimension table. For example,
IsWeekday = IF ( WEEKDAY ( Dim_Date[Date] ) IN { 2, 3, 4, 5, 6 }, 1, 0 )
You'll also want a column that groups the dates into months. For example,
MonthEnd = EOMONTH ( Dim_Date[Date], 0 )
Then your target might look like this (if it were a calculated column):
Target =
VAR CurrDate = Dim_Date[Date]
VAR CurrMonth = Dim_Date[MonthEnd]
VAR SubTable = FILTER ( Dim_Date, Dim_Date[MonthEnd] = CurrMonth )
RETURN
1000
* DIVIDE (
SUMX ( FILTER ( SubTable, Dim_Date[Date] <= CurrDate ), Dim_Date[IsWeekday] ),
SUMX ( SubTable, Dim_Date[IsWeekday] )
)
I am the OP and I didn't mark the post suggested as the solution, as the solution. I did get some inspiration from the post but didn't really use it.
Here is what worked for me - I use the date table from "Enterprise DNA" which you can read about here:
Extended Date Table Power Query M Function - Enterprise DNA
If you use the same date table, you can follow most of my formula below exactly.
Here is the measure that converts a montly target to a daily target, that only goes up on work days of the month. Note that "Monthly Hours Target'[Target Month]" is the column in the "target" table which has the target month in it (Jan, Feb, etc..). "Monthly Hours Target'[Target Hours]" is the column in the target table which has the hours in it.
I just drop this measure onto a bar chart, along with the "Target" and, each work day, the daily target will rise according to the workday of the month.
I am the OP and I didn't mark the post suggested as the solution, as the solution. I did get some inspiration from the post but didn't really use it.
Here is what worked for me - I use the date table from "Enterprise DNA" which you can read about here:
Extended Date Table Power Query M Function - Enterprise DNA
If you use the same date table, you can follow most of my formula below exactly.
Here is the measure that converts a montly target to a daily target, that only goes up on work days of the month. Note that "Monthly Hours Target'[Target Month]" is the column in the "target" table which has the target month in it (Jan, Feb, etc..). "Monthly Hours Target'[Target Hours]" is the column in the target table which has the hours in it.
I just drop this measure onto a bar chart, along with the "Target" and, each work day, the daily target will rise according to the workday of the month.
What you want is 1000 hrs * ( # weekdays so far this month ) / ( # weekdays in the month ).
This is easier to calculate if you have an IsWeekday column on your date dimension table. For example,
IsWeekday = IF ( WEEKDAY ( Dim_Date[Date] ) IN { 2, 3, 4, 5, 6 }, 1, 0 )
You'll also want a column that groups the dates into months. For example,
MonthEnd = EOMONTH ( Dim_Date[Date], 0 )
Then your target might look like this (if it were a calculated column):
Target =
VAR CurrDate = Dim_Date[Date]
VAR CurrMonth = Dim_Date[MonthEnd]
VAR SubTable = FILTER ( Dim_Date, Dim_Date[MonthEnd] = CurrMonth )
RETURN
1000
* DIVIDE (
SUMX ( FILTER ( SubTable, Dim_Date[Date] <= CurrDate ), Dim_Date[IsWeekday] ),
SUMX ( SubTable, Dim_Date[IsWeekday] )
)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
43 | |
26 | |
20 | |
14 | |
8 |
User | Count |
---|---|
75 | |
50 | |
47 | |
17 | |
17 |