Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Simplifying things, I have a report using DirectQuery with 2 tables: Date and EmployeeTimesheet.
Date columns: DayeKey, Date, Year, Month, DayOfWeek, isWeekday
EmployeeTimesheet columns: EmployeeID, DateKey, TaskID, MinutesWorked
Example:
EmployeeA, 20190101, Task1, 15
EmployeeA, 20190102, Task1, 15
EmployeeA, 20190102, Task2, 60
EmployeeA, 20190103, Task2, 90
What I'm trying to calculate (and graph) is the number of days out of all available weekdays where the employee worked at least 60 mins. So there are 23 weekdays in January (isWeekday=1). Therefore, in January, EmployeeA worked 2 days out of 23, or 8%.
I've tried defining a measure as below, and using it as a filter (Daily Time Total > 60), but it aggregates the hours to the Employee level and doesn't filter properly.
Daily Time Total =
CALCULATE(
SUM('EmployeeTimesheet'[MinutesWorked]),
ALLSELECTED('EmployeeTimesheet'[DateKey])
)
Solved! Go to Solution.
Hi @cmorrow
Please check WorkCount measure in attached file.Link the two tables with DateKey column.
Regards,
Cherie
Are you looking for something like NETWORKDAYS?
https://community.powerbi.com/t5/Quick-Measures-Gallery/Net-Work-Days/m-p/367362
No, I don't think so. When I try to translate that to my needs, it doesn't work. For example, if I were to do this in SQL:
select EmployeeID, count(DateKey) from (
select EmployeeID, f.DateKey
from EmployeeTimesheet f
join Date d on d.DateKey = f.DateKey
and f.DateKey between 20190101 and 20190131
and IsWeekday = 1
group by EmployeeID, f.DateKey
having sum(MinutesWorked) > 60
) a
group by EmployeeID
Just not sure if there's a way to do the same thing in DAX.
Hi @cmorrow
Please check WorkCount measure in attached file.Link the two tables with DateKey column.
Regards,
Cherie
Cherie -
You are my hero. That works perfectly. Thank you!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 47 | |
| 43 | |
| 40 | |
| 20 | |
| 15 |
| User | Count |
|---|---|
| 70 | |
| 67 | |
| 32 | |
| 27 | |
| 25 |