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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! 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.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 9 | |
| 8 | |
| 7 | |
| 6 |