Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi all,
My client's data is automatically recorded into google big query. Every day a new table is created with a datestamp in the same format. I am importing using import mode.
E.g. Todays table would be called Day_20190204
And the M import code is:
Day_20190204_Table = DB_Schema{[Name="Day_20190204",Kind="Table"]}[Data]
I wish to be able to write an M script to automatically import a certain number of days. E.g. Import today + the previous 30 days.
In R I would use the loop and paste functions. Is there something similar in M?
Is this possible?
Many thanks,
Matt
Solved! Go to Solution.
@Anonymous,
A method is to create a function in your PBIX file, then create a table containing all the date number of today + the previous 30 days, and invoke the function in this table. There is a similar video for your reference.
Day_20190204_Table = DB_Schema{[Name="Day_"&Number.ToText(date)&"",Kind="Table"]}[Data]
And you can check the M code in my scenario of the function.
(date as number)=> let Source = GoogleBigQuery.Database(null), #"bigquery-public-data" = Source{[Name="bigquery-public-data"]}[Data], austin_311_Schema = #"bigquery-public-data"{[Name="austin_"&Number.ToText(date)&"",Kind="Schema"]}[Data], #"311_service_requests_Table" = austin_311_Schema{[Name="311_service_requests",Kind="Table"]}[Data] in #"311_service_requests_Table"
Regards,
Lydia
@Anonymous,
A method is to create a function in your PBIX file, then create a table containing all the date number of today + the previous 30 days, and invoke the function in this table. There is a similar video for your reference.
Day_20190204_Table = DB_Schema{[Name="Day_"&Number.ToText(date)&"",Kind="Table"]}[Data]
And you can check the M code in my scenario of the function.
(date as number)=> let Source = GoogleBigQuery.Database(null), #"bigquery-public-data" = Source{[Name="bigquery-public-data"]}[Data], austin_311_Schema = #"bigquery-public-data"{[Name="austin_"&Number.ToText(date)&"",Kind="Schema"]}[Data], #"311_service_requests_Table" = austin_311_Schema{[Name="311_service_requests",Kind="Table"]}[Data] in #"311_service_requests_Table"
Regards,
Lydia
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
12 | |
8 | |
8 | |
7 |
User | Count |
---|---|
15 | |
13 | |
9 | |
7 | |
6 |