Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi
I'm trying to calculate the number of sick days lost in any given month and just hitting a brick wall!
I have a table of absence data with an absence start date and absence end date (which can be blank due to absence not yet finished), and also a date table in my model.
I'm able to calculate the total days lost for each individual absence event, but what i would like to do is calculate the days lost in each month and then plot on a visual
The data looks a bit like the below;
The desired result would be
Feb days lost = 5
Mar days lost = 8
Any help would be greatly appreciated!
Solved! Go to Solution.
@Anonymous
you can try to create a date table and a column
Column = COUNTROWS(FILTER('Table','Table'[Absence Start Date]<='date'[Date] &&('Table'[Absence End Date]>='date'[Date])||('Table'[Absence Start Date]<='date'[Date] &&ISBLANK('Table'[Absence End Date])&&'date'[Date]<=today())))
pls see the attachment below
Proud to be a Super User!
@Anonymous
you can try to create a date table and a column
Column = COUNTROWS(FILTER('Table','Table'[Absence Start Date]<='date'[Date] &&('Table'[Absence End Date]>='date'[Date])||('Table'[Absence Start Date]<='date'[Date] &&ISBLANK('Table'[Absence End Date])&&'date'[Date]<=today())))
pls see the attachment below
Proud to be a Super User!
you are welcome
Proud to be a Super User!
Thanks for the reply John, but i'm afraid this isn't giving me the desired result. For instance in my live dataset it's telling me just one day was lost on 28 Feb when i can see it's lots more from the raw data
Try
Days lost =
VAR MinDate =
MIN ( 'Date'[Date] )
VAR MaxDate =
MAX ( 'Date'[Date] )
VAR FullAbsenceTable =
GENERATE (
SUMMARIZE (
'Table',
'Table'[Employee ID],
'Table'[Absence start date],
'Table'[Absence end date]
),
VAR StartDate = 'Table'[Absence start date]
VAR EndDate =
MINX ( { 'Table'[Absence end date], TODAY (), MaxDate }, [Value] )
RETURN
CALENDAR ( StartDate, EndDate )
)
RETURN
COUNTROWS (
FILTER ( FullAbsenceTable, [Date] >= MinDate && [Date] <= MaxDate )
)
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
76 | |
76 | |
56 | |
37 | |
34 |
User | Count |
---|---|
99 | |
56 | |
54 | |
45 | |
40 |