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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
badluckmath
Frequent Visitor

HELP NEEDED: GETING DATA FROM API

I have to pull a data from a websource that provides a webAPI to downlood the data, here's a tamplate:

 

https://hq.appsflyer.com/export/com.greatapp/partners_report/v5?api_token=xxxx
&from=2018-04-09&to=2018-05-09&media_source=googleadwords_int

 

The problem is that, i need to insert a data range on this link, as you can see in the line "from=2018-04-09&to=2018-05-09".

This data will be used to make reports from a certain date up to today's date. But i need to do it without having to change the url everyday.

 

Is there any way of doing this using DAX?

 

Here is an example of a pull:

Sem título.png

I would like the data from July ( 2020-07-01 ) until this date. How to do that?

3 REPLIES 3
pranit828
Community Champion
Community Champion

Hi @badluckmath 

You can create two parametrs FromDate and ToDate for the same and use it in the example to pull 

for example 

= csv.Dcoument(web.Contents("https://hq.appsflyer.com/export/com.greatapp/partners_report/v5?api_token=xxxx&from="&FromDate&"&to="&ToDate&"&media_source=googleadwords_int"))





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

I need the date in the format yyyy-mm-dd, how would this be?

 

FORMAT(TODAY(), "YYYY-MM-DD") is not working for me, see how it looks:

 

"....from=2020-07-01&to="& FORMAT(TODAY(), "YYYY-MM-DD")&"&additional_fields=keyword_id,store_reinstall,...."

@badluckmath

Replace the date range text with the following text. If you created a parameter. replace #date(2020,7,1) with the parameter name

= ".... from=" & Date.ToText(#date(2020,7,1),"YYYY-MM-DD")& "&to=" & Date.ToText(Date.From(DateTime.FixedLocalNow()), "YYYY-MM-DD")


Result

.... from-2020-07-01-to-2020-09-20

________________________

If my answer was helpful, consider Accepting it as the solution to help other members find it

Click the Thumbs-Up icon if you like this answer 🙂

Youtube Linkedin

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.