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 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.
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.