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
AbhinavJoshi
Responsive Resident
Responsive Resident

Reference a query in the source step

Hello,

 

I would like to reference a query or a parameter in the source step. I am using sharepoint as my data source. I would like to get the current month and year value that changes every month (dynamically) in my source step. The format I would like Year-Month (Ex: 2023-10)

 

What I would like to achieve 

 

= Excel.Workbook(Web.Contents("www.mysharepoint.com" +  "Current Month and Year Parameter" + "FileName"), null, true)

 

I have made a query that gives me the value but I don't no how to reference it in the source step, here is the code for query.


let
currentDate = Date.From(DateTime.LocalNow()),
Custom1 = {currentDate},
#"Converted to Table" = Table.FromList(Custom1, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Split Column by Position" = Table.SplitColumn(Table.TransformColumnTypes(#"Converted to Table", {{"Column1", type text}}, "en-CA"), "Column1", Splitter.SplitTextByPositions({0, 7}, false), {"Column1.1", "Column1.2"}),
#"Removed Columns" = Table.RemoveColumns(#"Split Column by Position",{"Column1.2"}),
#"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Column1.1", "Date"}}),
Custom2 = {#"Renamed Columns"}
in
Custom2

 

Thank you in advance for the help,

Abhinav

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@AbhinavJoshi , You can get a date in the format like

 

= Excel.Workbook(Web.Contents("www.mysharepoint.com"  & Date.ToText(DateTime.LocalNow(), "yyyy-MM") &  "FileName"), null, true)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
AbhinavJoshi
Responsive Resident
Responsive Resident

Thanks @amitchandak . It intially gave me an error: We cannot convert the value #datetime(2023, 10, 18, 11, 6, 4.7513611) to type Date. But I passed Date.ToText(Date.From(DateTime.LocalNow())) instead of Date.ToText(DateTime.LocalNow(), "yyyy-MM")

Have a great day!

amitchandak
Super User
Super User

@AbhinavJoshi , You can get a date in the format like

 

= Excel.Workbook(Web.Contents("www.mysharepoint.com"  & Date.ToText(DateTime.LocalNow(), "yyyy-MM") &  "FileName"), null, true)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.