This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Hello,
For the life of me, I can't figure out why this doesn't work. I'm trying to get a list of all users of a Workspace, with pagination. I can't seem to get the if statement to work to build the URL to deal with paging. Maybe my approach is wrong, I don't know.
Advice?
let
vUrl = "https://slack.com/api/admin.users.list?team_id=12&limit=2",
vHeaders =[
#"Method"="POST",
#"Authorization"="Bearer " & SlackToken
],
theCursor = "",
GetData =() as table =>
let
url = if theCursor = "" then vUrl else vUrl & "&cursor=" & theCursor,
Source = Json.Document(Web.Contents(url , [Headers=vHeaders])),
tab = Table.Combine({Table.FromList(Source[users], Splitter.SplitByNothing(), null, null, ExtraValues.Error)}),
theCursor = source[response_metadata][next_cursor]
in tab,
Custom1 = List.Generate( () => [LastCount=2,res=GetData()],each [LastCount]<=3,each [LastCount=Table.RowCount([res])+1,res=GetData()],each [res]),
#"Converted to Table" = Table.FromList(Custom1, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandTableColumn(#"Converted to Table", "Column1", {"Column1"}, {"Column1.Column1"}),
#"Expanded Column1.Column1" = Table.ExpandRecordColumn(#"Expanded Column1", "Column1.Column1", {"id", "email", "is_admin", "is_owner", "is_primary_owner", "is_restricted", "is_ultra_restricted", "is_bot"}, {"Column1.Column1.id", "Column1.Column1.email", "Column1.Column1.is_admin", "Column1.Column1.is_owner", "Column1.Column1.is_primary_owner", "Column1.Column1.is_restricted", "Column1.Column1.is_ultra_restricted", "Column1.Column1.is_bot"})
in
#"Expanded Column1.Column1"
Hi @joshtwork ,
See if the following solutions are helpful to you.
Solved: Power query for pagination - Microsoft Power BI Community
If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |