Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Bessonnizza
Helper II
Helper II

Web.Contents - Timeout=#duration

Hi all!

 

Have POST request:

let
        data = Json.FromValue([StatisticsSessionId=paramStatisticsSessionId]),
        headers = [#"accept"="*/*", #"ScoutAuthorization"=paramAuthorizationId, #"Content-Type"="application/json"],
        web = Web.Contents("http://spic.scout365.ru:8081/spic/AnalogSensor/rest/GetStatistics", [ Content = data, Headers = headers, ManualStatusHandling = {404, 400}]),
        result = Json.Document(web)
    in
        result

 

Column Value.1 shows result (status) of execution query. If query fulfilled we get "Ok" answer. If query be in progress we get "Processing" answer.

 

How can i write expression:
IF (Value.1 = "Ok", then get answer, IF (Value.1 = "Procesing", wait "Ok" answer duration 1 min, error ) )?

 

OR make timeout to get last answer duration 1 min?

 

Request answer:

Screenshot_1.png

 

 

1 ACCEPTED SOLUTION

Solution:

 

GetStatistics = Table.AddColumn(StartBuild, "GetStatistics", each Function.InvokeAfter(()=>fnTrackPeriodsMileage_GetStatistics([SessionId], [StatisticsSessionId]), #duration(0,0,0,15))),

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Bessonnizza , power query is case sensitive . Try like

if [Value.1] = "Ok", then "A" else if [Value.1] = "Procesing" then "Ok" else "Error"

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak thx for reply, but i think you not understand me. I need not to replace "Processing" to "Ok", query should wait answer "Ok" (for example wait 1 min) in colomn Value.1, and then execute.

 

Now the request is being executed when get first answer, it can be "Ok" (data download), or it can be "Processing" (data is loaded). So i need to wait when query return me definite answer - "Ok" and only then download another colums with data (as shown in the screenshot above).

update

 

new exampleScreenshot_1.png

Solution:

 

GetStatistics = Table.AddColumn(StartBuild, "GetStatistics", each Function.InvokeAfter(()=>fnTrackPeriodsMileage_GetStatistics([SessionId], [StatisticsSessionId]), #duration(0,0,0,15))),

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors
Top Kudoed Authors