Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

Import files from folder and filter between consecutive dates in query editor.

Hi Power BI User;

 

I'm facing with a filter challenge. I'm updating data from a folder, in this folder there are two files (File 1 and File 2).  The two files have a date column, I would like to filter from the second file (file 2) only the consecutive date from file 1. It is possibile implementing this filter in the query editor?

 

Thank you in advance.

 

1 ACCEPTED SOLUTION

You want an Anti-Merge. Starting with table 2, merge the date column with the date column of Table 1, but select Left-Anti-Join.

2020-05-05 07_24_49-.png

It will return a table like this. This shows I've already deleted the merge column. There is no need to expand it as I only wanted to limit the rows of table 2, not actually bring in additional info from table 1.

2020-05-05 07_25_14-Untitled - Power Query Editor.png

 

See this Power BI file to see the full M code.

If your dates get wonky, change the Localization steps. I used Bahamas so your DD/MM/YYYY would work on my US region computer.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

9 REPLIES 9
edhans
Super User
Super User

Probalby, but you are goingt o have to give us some sample data. See links below. Don't give screenshots of data, but screenshots of expected results are ok.

How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
Greg_Deckler
Community Champion
Community Champion

Not sure I understand this, sample data would help tremendously. @ImkeF and @edhans may be able to pull off some magic.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Sorry for not being clear, I'm updating 2 files in PBI by folder method. here an example:

 

FILE 1

DateDimension 1Dimension 2Measure 1Measure 2
05/01/2020QX111RIR869Q95588721
06/01/2020VA710JBW316Q321485
07/01/2020TG490EJZ523B6357768
08/01/2020JT709IBJ144F21032841
09/01/2020OK911RAF937G57346670
10/01/2020SH554HMJ457X58937427
11/01/2020PC633WTZ711V50475213

 

FILE 2

 

DateDimension 1Dimension 2Measure 1Measure 2
05/01/2020QX111RIR869Q95588721
06/01/2020VA710JBW316Q321485
07/01/2020TG490EJZ523B6357768
12/01/2020JT709IBJ144F21032841
13/01/2020OK911RAF937G57346670
13/01/2020SH554HMJ457X58937427
13/01/2020PC633WTZ711V50475213

 

I would like to find a method in the query editor (if possibile) to filter from the FILE 2 only the consecutive date from file 1 and excluding from the file 2 the date that are present in the file 1.

I'm sorry, but I don't know what this means. 

"I would like to find a method in the query editor (if possibile) to filter from the FILE 2 only the consecutive date from file 1 and excluding from the file 2 the date that are present in the file 1."

 

Can you show us expected output?



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

@Anonymous ,

 

It seems the dates which have been marked as green are not consecutive date. Could you please clarify more details about the logic of your requirement?

 

Regards,

Jimmy Tao

Anonymous
Not applicable

You are right, the only consecutive dates that I would like to filter from the files 2 are the following:

 

12/01/2020JT709IBJ144F21032841
13/01/2020OK911RAF937G57346670
13/01/2020SH554HMJ457X58937427
13/01/2020PC633WTZ711V50475213

 

The final output would be to have in PBI the FILE 2 which contains only the rows that correspond successive dates from FILE 1. It is possibile to improve this in the query editor?

 

Thank you in advance

You want an Anti-Merge. Starting with table 2, merge the date column with the date column of Table 1, but select Left-Anti-Join.

2020-05-05 07_24_49-.png

It will return a table like this. This shows I've already deleted the merge column. There is no need to expand it as I only wanted to limit the rows of table 2, not actually bring in additional info from table 1.

2020-05-05 07_25_14-Untitled - Power Query Editor.png

 

See this Power BI file to see the full M code.

If your dates get wonky, change the Localization steps. I used Bahamas so your DD/MM/YYYY would work on my US region computer.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
Anonymous
Not applicable

This solution is very smart! Thank you very much!

Glad I was able to help @Anonymous 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.