Forum Discussion
Count of Active Projects between two dates
Thank you. I want to understand what you did...I think (based on a lot of videos I watched yesterday) you created a Date table for the min and max date in the Data table, then linked that date table to program IDs with that date, right? But I don't see a start and end date for each program just one date.
I was able to accomplish what I needed by (I think) doing something similar to what you did although I think it could be done better and more simplified. I copied the query that created my Program table and then added a column that was a list. This list was a list of years from start year to end year for that particular program. Then I expanded the list to be separate rows for each item in the list. This then gave me records for each program for each year, which I can then use to report on. I think though there is a better way to create this last table so it only contains the program ID and year (similar to one of yours). Mine is not a date table so it doesn't contain dates for everything inbetween like yours, it just contains that extra year field. I didn't know how in DAX or the Power Query how to create that table with the values and to link it to the original one so that all new rows would also get updated in my new one, so I simply copied the existing Query and renamed it because I didn't want all those extra rows in the initial one. So I think I ended up doing something like you did just slightly different. Thank you!
Hi,
My method creates one row for each month between the beginning and ending date. You will see all steps in the Query Editor.
- kirtanap3 years agoRegular Visitor
helo,
i have a simple table with project id, yard, start and end date of multiple projects. i want to create a histogram that shows the no of active projects by week. eg:
Project Yard Type start end
msc china NB 16/06/2023 20/03/2023 carnival china RF 17/06/2023 24/03/2023 maersk korea RF 20/06/2023 21/03/2023 eg: in this case, the histogram should have the value as 2 for the date17/6/23 as 2 projects are in progress and when i click on this, it should show me the project ID, yard of the 2 projects that are in progress. how can i achieve this best
- Ashish_Mathur3 years agoSuper User
Hi,
You may download my PBI file.
Hope this helps.
- Anonymous2 years agoNot applicable
Hi Ashish, I think i could use your solution as well.
Could you reshare the file where one row for every motnh was created?
- Ashish_Mathur2 years agoSuper User
Hi,
Refer to this link - Generating Rows by Month for Date Ranges in Power Query | by Daniel Marsh-Patrick | Daniel Marsh-Patrick | Medium