Forum Discussion
Filter Old Draft Folders
- 4 months ago
The grouping is currently set at the Draft folder level, which is why you’re seeing one file per Draft instead of one per PR folder.
You should group at the PR-26*** level so all Draft folders are considered together. Then, use the maximum modified date within each group and filter to that row. This will give you only the most recent file across all Draft folders for each PR.
If you still get multiple rows, sort within each group and keep just the top row to ensure a single result.
Please try this approach and let us know how it works for you.
I'll give that a shot on Monday when I'm at work and let you know how it goes.
Just following up did you have a chance to test this on your side? Please let us know how it went or if you’re still experiencing the same issue.
- JPorterValmetal4 months agoFrequent Visitor
Ok. I I got it. I'm not sure if I did it the best way, but I made it work. I split my file path column using "\" as a delimeter. Grouped the PR-26*** folders based on max date modified. I made a new query using the same source folder, and did an inner merge on the two queries using max modified date and last modified date.
- JPorterValmetal4 months agoFrequent Visitor
I'm a little confused on the last step. When I add a date filter by equals, I have to choose a specific date. Do I need to make a custom collumn comparing the Last Modified Date, and the Max Modified Date. Then filter out everything that is false from the custom column?
- JPorterValmetal4 months agoFrequent Visitor
I used the custom column that I described above and I'm still having the same issue. It's not getting rid of the "draft" folders that have older files in them. It's giving me the latest file that is in every "draft" folder.
Here is a screenshot of the folder structure when there are multiple draft folders.
I want the final result to show the most recent file path out of the "draft" folders. If draft 4 has the most recent file, show only that file path. If draft 02 has the most recent file show only the draft 02 file path.
The current result I am getting is the file path for the most recent file in ALL of the draft folders.
- ralf_anton4 months agoResolver I
JPorterValmetal wrote:I want the final result to show the most recent file path out of the "draft" folders. If draft 4 has the most recent file, show only that file path. If draft 02 has the most recent file show only the draft 02 file path.
Dann verwende den oberen Beispielcode. Und wie ich schon sagte:
... solltest Du aus der Quelle in der Spalte Folder Path noch alle unerwünschten Ordner herausfiltern.
- V-yubandi-msft4 months agoCommunity Support
The grouping is currently set at the Draft folder level, which is why you’re seeing one file per Draft instead of one per PR folder.
You should group at the PR-26*** level so all Draft folders are considered together. Then, use the maximum modified date within each group and filter to that row. This will give you only the most recent file across all Draft folders for each PR.
If you still get multiple rows, sort within each group and keep just the top row to ensure a single result.
Please try this approach and let us know how it works for you.
- JPorterValmetal4 months agoFrequent Visitor
I'm very new to Power Query as you can probably tell. How do change the level at which the grouping is done? I've always used the "Group By" button.