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.
Hi,
I've spent way too much time on this now, so I have to ask for some help.
I have 2 tables:
data: holds data from git commits
Dates: holds a full range of dates
The tables are related via Dates[date] ==> data[commiterDate]
This code works for counting the number of work days in selected date span on each row.
(The user can set a date span via a date slider control).
Sum wrk.days =
COUNTROWS(
FILTER(
DATESBETWEEN(Dates[Date], MIN(data[committerDate]), MAX(data[committerDate])),
WEEKDAY(Dates[Date], 2) < 6
)
)
Sum should be 7...
Solved! Go to Solution.
If good.spread and oneCommitter overlapped a day, then the total makes sense.
If you want to sum the rows, then you need to iterate over commiterid somehow. One option:
Commiter Work Days = SUMX ( VALUES ( data[committerId] ), [Sum wrk. days] )
If good.spread and oneCommitter overlapped a day, then the total makes sense.
If you want to sum the rows, then you need to iterate over commiterid somehow. One option:
Commiter Work Days = SUMX ( VALUES ( data[committerId] ), [Sum wrk. days] )
Thank you, it works!
Just the kind of simple solution I was looking for. 👍
The code now:
Wrk.days =
SUMX(
VALUES(data[committerId]),
[Wrk.days row count]
)
---
Wrk.days row count =
VAR cr =
COUNTROWS(
FILTER(
DATESBETWEEN(Dates[Date], [MinDate], [MaxDate]),
WEEKDAY(Dates[Date], 2) < 6
)
)
RETURN
IF(
cr > 0,
cr,
1
)
@petluo can you try this
Measure =
SUMX (
SUMMARIZE (
ADDCOLUMNS (
data,
"daysCount",
CALCULATE (
COUNT ( Dates[Date] ),
(
FILTER (
DATESBETWEEN (
Dates[Date],
CALCULATE ( MIN ( data[committerDate] ), ALLEXCEPT ( data, data[committerid] ) ),
CALCULATE ( MAX ( data[committerDate] ), ALLEXCEPT ( data, data[committerid] ) )
),
WEEKDAY ( Dates[Date], 2 ) < 6
)
)
)
),
data[committerid],
[daysCount]
),
[daysCount]
)
Thank you!
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 |
---|---|
110 | |
94 | |
82 | |
66 | |
58 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |