Forum Discussion

ghoshabhijeet's avatar
ghoshabhijeet
Solution Supplier
5 years ago
Solved

Error while schedule refresh - getting error " This dataset includes a dynamic data source. "

Hi there,   I have developed a dashboard where the data is being pulled from Jira. The limitation of JQL is it gives 100 results at a time. So, I had to run loop to get all the data using Power Que...
  • ghoshabhijeet's avatar
    ghoshabhijeet
    4 years ago

    Anonymous  I have worked on your issue and it's solved. I have tested the solution on Power BI Service and the code works perfectly fine. The data is getting refreshed in Power BI Service.


    Here is my M-Code solution:

     

    let
    Source = Json.Document(Web.Contents("https://insyncsolutions.atlassian.net",
    [RelativePath="/rest/api/3/search",Query=[q="jql=project in('BI')"],
    Headers=[Authorization="Basic " & Credentials]])),
    totrecords = Source[total],
    CurrentstartAtList = List.Generate(()=>0, each _ < totrecords, each _ +100),
    //a= List.Transform(CurrentstartAtList, each """" & Text.From(_) & """"),

    data = List.Transform(CurrentstartAtList, each Json.Document(Web.Contents("https://insyncsolutions.atlassian.net",
    [RelativePath="/rest/api/3/search",
    Query=[maxResults="100",startAt=Text.From(_),jql="project in('BI')"],
    Headers=[Authorization="Basic " & Credentials]]))),
    #"Converted to Table" = Table.FromList(data, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"expand", "startAt", "maxResults", "total", "issues"}, {"Column1.expand", "Column1.startAt", "Column1.maxResults", "Column1.total", "Column1.issues"}),
    #"Expanded Column1.issues" = Table.ExpandListColumn(#"Expanded Column1", "Column1.issues"),
    #"Expanded Column1.issues1" = Table.ExpandRecordColumn(#"Expanded Column1.issues", "Column1.issues", {"id", "key", "fields"}, {"id", "key", "fields"}),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded Column1.issues1",{"Column1.expand", "Column1.startAt", "Column1.maxResults", "Column1.total"}),
    #"Filtered Rows" = Table.SelectRows(#"Removed Columns", each ([id] <> null))
    in
    #"Filtered Rows"

    Power BI Service Data Refresh Success:

     

     


    ** If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution, so that it comes in top of the search and help others. Thank you !

    Good Luck 👍