Forum Discussion

badluckmath's avatar
badluckmath
Frequent Visitor
5 years ago

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:

 

i tried to put a formula that gives me the time formart i needed between the url like this :

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

 

but it didn't worked.

Please, help!

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    I have the exact same question.  So far I've not seen any solutions. 

    • ImkeF's avatar
      ImkeF
      Community Champion

      Hi all,

      as you're doing this in the query editor, you have to use the M-language (Power Query) and not DAX.

       

      This is how to retrieve todays date formatted as text in the desired format:

       

      Date.ToText ( Date.From ( DateTime.LocalNow() ) , "yyyy-MM-dd" )

       

      If you want to refresh these queries in the Power BI service, you have to make further adjustments like mentioned in the article that amitchandak has posted.