Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowData Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more
Hello there!
I try to realize helper function Value.WaitFor:
let
Value.WaitFor = (producer as function, interval as function, optional count as number) as any =>
let
list = List.Generate(
() => {0, null},
(state) => state{0} <> null and (count = null or state{0} < count),
(state) => if state{1} <> null then {null, state{1}} else {1 + state{0}, Function.InvokeAfter(() => producer(state{0}), interval(state{0}))},
(state) => state{1})
in
List.Last(list)
in
Value.WaitFor
But when i add this function to my request - PQ appeals to web service only one time and return null although by condition he must appeals 5 times. Can somebody explain me where i make mistake? I am hope for your help.
My request:
let
result = fnValueWaitFor(
(iteration) =>
let
data = Json.FromValue([StatisticsSessionId = StatisticsId]),
headers = [
#"accept" = "*/*",
#"ScoutAuthorization" = AuthorizationId,
#"Content-Type" = "application/json"
],
web = Web.Contents(
"url",
[
Content = data,
Headers = headers,
Timeout = #duration(0, 0, 0, 10),
ManualStatusHandling = {404, 400}
]
),
buffered = Binary.Buffer(web),
status = Json.Document(buffered)[ChunkInfo][Status][Value],
actual_result = if status = "Ok" then Json.Document(buffered) else null
in
actual_result,
(iteration) => #duration(0, 0, 0, 1),
5
)
in
result
I am also getting the error message when I try to use this pattern.
Expression.Error: The name 'Value.WaitFor' wasn't recognized. Make sure it's spelled correctly.
@Bessonnizza were you able to get this pattern working?
Hello. I am trying to incorporate Value.WaitFor in my code but it is unrecognizable? Was this disabled by Power BI? If yes, are there any alternative?
Need help!
Thanks experts!
This was never a part of the released version of Power BI. It is a custom function and needs to be entered as such.
Somebody have any ideas?
This was never a part of the released version of Power BI. It is a custom function and needs to be entered as such.
Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.
Check out the May 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 1 |
| User | Count |
|---|---|
| 11 | |
| 11 | |
| 5 | |
| 4 | |
| 4 |