The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have access and connected to a rest API to pull in some sales data. The api is restricted to 90 days worth of data. My question is, how do I configure Power BI to pull in current data while archiving the historical data? OR if that's not possible, how do I configure the data source of the API to adjust the data call by one day?
The call lanuage is: https://website/order_items?time_start=2020-01-20T21:30:13.247Z&time_end=2020-04-15T21:30:13.247Z. In order to keep the current data coming in, I would have to manually adjust the start time and end time. I would like to have this automated, while keeping a track of the previous days data.
What is the best way to call multiple URL strings? I tried editing my Json.documeent(Web.contents(www.apiurl parameter/) with an AND command but it doesn't work. Is there another place to join the api calls?
@vwiles84 did you tried my solution, parameters in that is already part of URL
Ask anything Power BI. Book appointment for a free consultancy at https://www.perytus.com
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
I have not yet. I will now but, i think if I can just make 4 calls with the 90 day date range (01/01/20-03/31/20 then 4/1/20-6/30/20, then 7/1/20-9/30/20, etc), it will work the same. I don't know that i need to specify the max number of 90 if I can make 4 API calls with the date range changed. If that make sense.
@vwiles84 this M code will create start and end date range and will update daily, just add another column and make api call from the WebURL column and you are good to go.
let
MaxDays = 90,
EndDate = Date.From(DateTime.LocalNow()),
StartDate = Date.AddDays(Date.From(EndDate),1-MaxDays),
Source = #table({"StartDate","EndDate"} ,{{StartDate,EndDate}}),
#"Changed Type1" = Table.TransformColumnTypes(Source,{{"StartDate", type datetime}, {"EndDate", type datetime}}),
#"Added Custom" = Table.AddColumn(#"Changed Type1", "WebURL", each "https://website/order_items?time_start=" &
DateTime.ToText([StartDate],"yyyy-MM-dd")&"&time_end="&DateTime.ToText([EndDate], "yyyy-MM-dd"), type text),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "WebData", each Web.Contents([WebURL]))
in
#"Added Custom1"
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
I can't get this to work.
@vwiles84 are you getting error or what? You have to provide more details otherwise I have no idea what should I reply. Is this url public or paid? Is there way I can test at my end?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
It is no a public api, i have generated a token from the SaaS
There is no error, it just displays all of the query in red.
@vwiles84 don't know why but it works at my end. Assuming you pasted the whole code and replaced your existing code. Can you share pbix file using one drive/google drive to get your answer quickly? Remove any sensitive information before sharing it.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
I started with a blank query, copied your coded and modified it to include the whole API call.
@vwiles84 so do you see the table or you are not even getting the table with all the columns before you make an api call, (before last step)
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
I do not see a table or columns
@vwiles84 seems like code is not copied correctly, you should be seeing this
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
When I copy the code in the query, it converts it to this
OK i got it to work by using the advanced editor.
But it is erroring out and not brining in the sales data. it's just showing the 2 date. Trying to view the error locked up my query editor. So I'm not sure this is going to work.
I will try to connect the 4 calls with the date range in 90 day intervals. I can make multiple calls so I just have to find the best way to do that.
Thanks for your help.
Thank you! I will try that and see how it works!