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.
Hello,
I would like to create a measure to sum up the amount of projects between a specified date range by using a slicer. See an example table below. If the chosen date range is not covered by the project duration, it shall not be counted respectively if it covers only partially, then the corresponding fraction of the project amount shall be used.
E.g. slicer date is set from 01.11.2023 to 31.03.2024, then I would expect a calculation like this:
3/6 * 10.000 + 5/6*15.000 + 3000 + 1.5/6.5 * 9.000 = 22.576,92
Projectname | Start | End | Amount |
A | 01.01.2024 | 31.05.2024 | 10.000 |
B | 01.10.2013 | 31.03.2024 | 15.000 |
C | 15.01.2024 | 15.02.2024 | 3.000 |
C | 16.02.2024 | 31.08.2024 | 9.000 |
For the dashboard, I would like to use the table visual to see the aggregated amount of each project as well as the aggregated amount of all project. There are other attributes as well e.g department etc.. The measure shall also work when I want to use those attributes for filtering the table visual.
I hope there is someone who can help me as this issue drives me crazy 😄
Greetings,
Patrick
Solved! Go to Solution.
Hi, check this out,
first you wanna calculate the difference in days you have between start and end date of the project.
then you want to see the difference in days between the start date and the min date of the slicer as well as end date of the project and max date of the slicer. In the end, if any of those date differences are negative, meaning the slicer dates are before or after the project, you want to subtract those days.
I used 30 as a monthly average of days to calculate the proportions.
Remark: for Project A, it is not 3/6, but 3/5
Hi, check this out,
first you wanna calculate the difference in days you have between start and end date of the project.
then you want to see the difference in days between the start date and the min date of the slicer as well as end date of the project and max date of the slicer. In the end, if any of those date differences are negative, meaning the slicer dates are before or after the project, you want to subtract those days.
I used 30 as a monthly average of days to calculate the proportions.
Remark: for Project A, it is not 3/6, but 3/5
Hello Olgad,
Thank you very much for your very fast reply, it gave me some good hints to solve my issue.
In your implementation of the ProjectDaysInSlicerPeriod, I had the issue that I got negative values if e.g. the start of the slicer was bigger then the end date of the project. Thus I created some correction values in a similiar manner using the DATEDIFF function:
Hi @Päät ,
Have you solved your problem? If so, can you share your solution here and mark the correct answer as a standard answer to help other members find it faster? Thank you very much for your kind cooperation!
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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 |
---|---|
10 | |
9 | |
9 | |
8 | |
8 |
User | Count |
---|---|
14 | |
12 | |
11 | |
11 | |
8 |