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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
preetisb15
Frequent Visitor

JIRA- power BI pagination (Mquery)

Dear all,

 

I have been referring to https://medium.com/@marktiedemann/how-to-do-pagination-in-power-query-430460c17c78 and a few posts like https://community.powerbi.com/t5/Desktop/Jira-Surpass-MaxRsults-gt-1000/m-p/1213351 for JIRA- power BI integration and getting > 1000 pulls at the same time.

 

No issues with the connection iself. However the pull contains only 2000 rows , while it has to contain 18250 rows.. would anyone be able to reveiw the code?

 

 

 

 

let 
    BaseUrl = "https://xxx.atlassian.net/rest/api/3/search?jql=project in ('QAS')",
    JiraIDPerPage = 1000,
 
    GetJson = (Url) =>
        let 
            RawData = Web.Contents(Url),
            Json    = Json.Document(RawData)
        in  Json,
 
    GetJiraIDCount = () =>
        let Url   = BaseUrl & "&maxResults=0",
            Json  = GetJson(Url),
            Count = Json[#"total"]
        in  Count,
 
    GetPage = (Index) =>
        let Skip  = "&startAt=" & Text.From(Index * JiraIDPerPage),
            Top   = "&maxResults=" & Text.From(JiraIDPerPage),
            Url   = BaseUrl & Skip & Top,
            Json  = GetJson(Url),
            Value = Json[#"issues"]
        in  Value,
 
    JiraIDCount = List.Max({ JiraIDPerPage, GetJiraIDCount() }),
    PageCount   = Number.RoundUp(JiraIDCount / JiraIDPerPage),
    PageIndices = { 0 .. PageCount - 1 },
    Pages       = List.Transform(PageIndices, each GetPage(_)),
    JiraID    = List.Union(Pages),
    Table       = Table.FromList(JiraID, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
in
    Table

 

 

 

 

1 REPLY 1
lbendlin
Super User
Super User

When you troubleshoot

 

GetJiraIDCount = () =>
        let Url   = BaseUrl & "&maxResults=0",
            Json  = GetJson(Url),
            Count = Json[#"total"]
        in  Count,

 

Does it actually return your expected count? 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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