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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
jjkrmr
Frequent Visitor

Function to Filter Sharepoint files from Folder

I am hoping someone could determine if this is even possible? I am given excel files that have certain date ranges based on worker information. The date ranges in the files will overlap because sometimes the content changes or has to be approved etc. Ultimately, we could list the name of the file and filter the content to only include the date ranges where it has not been covered from a previous file with a StartDate and EndDateParameters that are specific to each file. Each week a new file will be added to follow this pattern.

The function would use the from Sharepoint Folder connector and transform the contents based on the output of each files start/end date.

 

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("dZm9kiUnDIVfZWridV8kfhryfQKnWxts4MxVdtkb7OO7mws6h7bISPorPu4RSDPfvn3+/sfff/3z8+Prj58/Pn77CO0I+dD4Xmq5lsevP//99fnls73yS4PGvtQy1+Hz+5f/Ueqh1ShSiVJfWoERW8sGo8DoilHC2Fo3GAFGVowQxtbRx0gyTEgLRhIwtkw+JZyDMk4JlHN+yaeUPcp5RAGFlc5XFMLYuvgYTYaRtGA0AQO908cInLoeMEJSWG4oYVCGHlGCbYD8mo8J0TC6OkVQoCduhMs7/aQ3MYXSz37iZrgc0sAJC0caccxQ3BCXdwGQIXGUTscwbogL6rus9V1Q32woboovRjNMF5yYC9LAgaG4Oc6o8LJWeKYKZ0Nxg5wPgVY3BEfIy5biBjkfYd5bwxAYFCQZipvkCyPArFZCGEi5SU6ozuE3MYniy4LqRjmhPIcgOIgvGaqb5IT6HIKECbQdw7hBTqjPtNZnQnhZUN0gX4zTMEt9XpATHAiqm+SLE8AJKycQx9bqJjkeAq2lPuNLyMuW6gY5HmFeO8MQGKtJNlQ3yIrTGYITo/QtG6qbZMXpDEHiBHBgqG6UFaczDMHBt6zoJllxOrqejuLTxdBNshwxAMOnI68YiANDN8q9BiZnOZ2rBnAibOhmWQ6B1nI68hLywum4UZYjzEt5GAKDG4sMo5vkC6OG0YcVMBCMXpLvy/w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K1x1S6aYTMNzrqdmkQKTIJn2I2D0Ujdk8bBSCQSvcL9/T8=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, FileStartDate = _t, FileEndDate = _t, Index = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"FileStartDate", type date}, {"FileEndDate", type date}, {"Index", Int64.Type}})
in
    #"Changed Type"

 

Here is an example of what a file might look like for the content. For this "file", it would need to be filtered to show only 1 row or day because all other days are covered from a more recent file.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("XdDLDcMwDIPhXXwOYJNy/JglyP5rpCggNuxN+HjSf10FjHKUVYnK9r3Pch8vZ/pwj/Tp3tOX+5m+3Uc6mg9TA3xYGujD1hA2RNPQfdDTeH+968+HuWJgmisGlrliYJsrBpu5YhDmakGaKwXDXCXY/S+V4N/D+pifj+8H", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Worker = _t, Date = _t, Value = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Worker", Int64.Type}, {"Date", type date}, {"Value", Int64.Type}})
in
    #"Changed Type"

 

 

jjkrmr_1-1695846384569.png

 

2 REPLIES 2
lbendlin
Super User
Super User

It might be simpler to do a full crossjoin and then for each data row pick the "newest"  file.

 

Maybe provide some more sample data?

Thanks. Let me think about how I could provide some addtional samples of data. I think the real challenge is I will be calling a function to be run against a sharepoint folder and have it recognize this logic some how. So as we expand rows on the actual file it knows that it needs to exclude certain rows.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors