Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
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.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 3 | |
| 3 | |
| 1 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 |