Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi All, I am struggling for one of the requirements. please help me here.
I have data something like this whare I need to calculate number of days a resource took on a stretch and number of days too.
Resource ID | Leave transaction date | Hours |
1001 | 01/03/2022 | 8 |
1001 | 02/03/2022 | 8 |
1001 | 03/03/2022 | 7 |
1001 | 04/06/2022 | 8 |
1001 | 05/06/2022 | 8 |
1001 | 06/06/2022 | 8 |
1001 | 07/06/2022 | 8 |
2002 | 03/02/2022 | 8 |
2002 | 04/02/2022 | 8 |
2002 | 05/02/2022 | 8 |
2002 | 06/02/2022 | 8 |
2002 | 03/05/2022 | 8 |
2002 | 07/06/2022 | 8 |
2002 | 08/06/2022 | 8 |
2002 | 09/06/2022 | 6 |
and I need something like this to be displayed in th ereport.
Resource ID | Leave start date | leave end date | Leave Hours | Leave days |
1001 | 01/03/2022 | 03/03/2022 | 23 | 3 |
1001 | 04/06/2022 | 07/06/2022 | 32 | 4 |
2002 | 03/02/2022 | 06/02/2022 | 32 | 4 |
2002 | 03/05/2022 | 03/05/2022 | 8 | 1 |
2002 | 07/06/2022 | 09/06/2022 | 22 | 3 |
Solved! Go to Solution.
@Anonymous
maybe you can try to create two columns
start = minx(FILTER('Table','Table'[Resource ID]=EARLIER('Table'[Resource ID])&&year('Table'[Leave transaction date])=year(EARLIER('Table'[Leave transaction date]))&&month('Table'[Leave transaction date])=month(EARLIER('Table'[Leave transaction date]))),'Table'[Leave transaction date])
end = MAXX(FILTER('Table','Table'[Resource ID]=EARLIER('Table'[Resource ID])&&year('Table'[Leave transaction date])=year(EARLIER('Table'[Leave transaction date]))&&month('Table'[Leave transaction date])=month(EARLIER('Table'[Leave transaction date]))),'Table'[Leave transaction date])
then create a measure
days = DATEDIFF(max('Table'[start]),max('Table'[end]),DAY)+1
pls see the attachment below
Proud to be a Super User!
@Anonymous
maybe you can try to create two columns
start = minx(FILTER('Table','Table'[Resource ID]=EARLIER('Table'[Resource ID])&&year('Table'[Leave transaction date])=year(EARLIER('Table'[Leave transaction date]))&&month('Table'[Leave transaction date])=month(EARLIER('Table'[Leave transaction date]))),'Table'[Leave transaction date])
end = MAXX(FILTER('Table','Table'[Resource ID]=EARLIER('Table'[Resource ID])&&year('Table'[Leave transaction date])=year(EARLIER('Table'[Leave transaction date]))&&month('Table'[Leave transaction date])=month(EARLIER('Table'[Leave transaction date]))),'Table'[Leave transaction date])
then create a measure
days = DATEDIFF(max('Table'[start]),max('Table'[end]),DAY)+1
pls see the attachment below
Proud to be a Super User!
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 |
---|---|
72 | |
71 | |
57 | |
38 | |
36 |
User | Count |
---|---|
81 | |
67 | |
61 | |
46 | |
45 |