Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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 July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
3 | |
3 | |
1 | |
1 | |
1 |
User | Count |
---|---|
8 | |
5 | |
4 | |
4 | |
2 |