Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
I have a REST API query that I need to load into Power BI and the API limits data in 180 day increments per API call. If I have over 2 years of data to load, I thought I could create a table called TRIMESTERS with a list of various date ranges such as this:
How do I reference the above dates in the query below for the saleTimestampRange filter?
let
Source = Xml.Tables(Web.Contents("https://xxxxxxx/recurringservices?" & "saleTimestampRange=2018-05-01", [Headers=[app_id="xxxxxxx", app_key="xxxxxxx"]])),
Table2 = Source{2}[Table],
Table0 = Table2{0}[Table],
#"Changed Type" = Table.TransformColumnTypes(Table0,{{"recurringServiceId", type text}, {"createTimestamp", type datetime}, {"memberId", type text}, {"agreementNumber", Int64.Type}, {"memberFirstName", type text}, {"memberLastName", type text}, {"salesPersonId", type text}, {"salesPersonFirstName", type text}, {"salesPersonLastName", type text}, {"recurringServicePlanId", type text}, {"recurringServiceStatus", type text}, {"recurringServiceSubStatus", type text}, {"recurringTypeDesc", type text}, {"numberBilled", Int64.Type}, {"totalPeriods", type text}, {"invoiceTotal", Int64.Type}, {"frequency", type text}, {"reorderQuantity", Int64.Type}, {"serviceItem", type text}, {"unitPrice", Int64.Type}, {"autoRenew", type logical}, {"purchasedClub", Int64.Type}, {"serviceEmployeeId", type text}, {"serviceEmployeeFirstName", type text}, {"serviceEmployeeLastName", type text}, {"campaignName", type text}}),
#"Expanded recurringServiceDates" = Table.ExpandTableColumn(#"Changed Type", "recurringServiceDates", {"saleDate", "firstBillingDate", "inactiveDate", "deactivateReason", "lastModifiedTimestamp", "nextBillingDate"}, {"recurringServiceDates.saleDate", "recurringServiceDates.firstBillingDate", "recurringServiceDates.inactiveDate", "recurringServiceDates.deactivateReason", "recurringServiceDates.lastModifiedTimestamp", "recurringServiceDates.nextBillingDate"}),
#"Expanded commissionsEmployeeIds" = Table.ExpandTableColumn(#"Expanded recurringServiceDates", "commissionsEmployeeIds", {"commissionsEmployeeId"}, {"commissionsEmployeeIds.commissionsEmployeeId"})
in
#"Expanded commissionsEmployeeIds"
Solved! Go to Solution.
Hi @patelaz
You can convert your API Query into a function, something like below.
( dates as text ) => let
Source = Xml.Tables(Web.Contents("https://xxxxxxx/recurringservices?saleTimestampRange=" & dates, [Headers=[app_id="xxxxxxx", app_key="xxxxxxx"]])),
Table2 = Source{2}[Table],
Table0 = Table2{0}[Table]
in
Table0
And later In your dates table go to Add Column ribbon > Invoke Custom Funktion and adjust the setting to reflect the below.
Hi @patelaz
You can convert your API Query into a function, something like below.
( dates as text ) => let
Source = Xml.Tables(Web.Contents("https://xxxxxxx/recurringservices?saleTimestampRange=" & dates, [Headers=[app_id="xxxxxxx", app_key="xxxxxxx"]])),
Table2 = Source{2}[Table],
Table0 = Table2{0}[Table]
in
Table0
And later In your dates table go to Add Column ribbon > Invoke Custom Funktion and adjust the setting to reflect the below.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 6 | |
| 6 | |
| 5 |