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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Concept
New Member

Populating ODATA query from a data table

Hi Everyone,

 

I have an ODATA feed which pulls data back to PowerBI and is functioning.

 

It has been created using a blank query, where the number highlighted in blue is the data point reference

 

let
      Source = OData.Feed("https://odata.c3ntinel.com/v0.1/", null, [Implementation="2.0"]),
      SelectFunction = Source{[Name="GetCustomDatesMeterReadings",Signature="function (meterId as number, resolution as text, start_date as datetimezone, end_date as datetimezone) as nullable record"]}[Data],
     GetCustomDatesMeterReadings = SelectFunction(287915, "Month", #datetimezone(2022, 1, 1, 0, 0, 0, 0, 0), #datetimezone(2025, 01, 31, 0, 0, 0, 0, 0)),
     Readings = GetCustomDatesMeterReadings[Readings]

in
     Readings

 

I have a large number of data point references that I need to pull. 

I have already imported the list of reference numbers as a data table.

 

Is there any way of dymanically changing the reference number in the ODATA call so that I don't have to either hard code the refernce numbers or create 50+ query tables?

 

Many thanks  

1 REPLY 1
smpa01
Super User
Super User

@Concept  yes, it is doable in theory but performance will take a huge hit and it is not scalable.

 

Pseudocode

 

// write a function get_data with table_num parameter
// pseudocode
(table_num as integer)=>
let
      Source = OData.Feed("https://odata.c3ntinel.com/v0.1/", null, [Implementation="2.0"]),
      SelectFunction = Source{[Name="GetCustomDatesMeterReadings",Signature="function (meterId as number, resolution as text, start_date as datetimezone, end_date as datetimezone) as nullable record"]}[Data],
     GetCustomDatesMeterReadings = SelectFunction(table_num, "Month", #datetimezone(2022, 1, 1, 0, 0, 0, 0, 0), #datetimezone(2025, 01, 31, 0, 0, 0, 0, 0)),
     Readings = GetCustomDatesMeterReadings[Readings]

in
     Readings


//table_num list
table_num = [1,2,3,....n]

//forEach in table_num invoke get_data
List.Geneerate() - POWER Query For loop

 

 

Better alternative (if you have fabric), use notebook to perform this task.

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors