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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ErikBI
Resolver I
Resolver I

Trouble with Odata query with relativepath in PowerQuery

Hello!

 

For a query I am currently using Odata with the relativepath function. I am trying to pass a date filter through the query but I'm having issues in Powerbi.

 

Essential I am replacing part of my query where="1=1", with where=" tijdstip+>+DATE+'2023-06-29'", 

This works no problem in the actual normal query...

(both of these work)

 

https://XXX/server/rest/services/XXX/FeatureServer/0/query?where=tijdstip+>+DATE+'2023-06-29'&outFields=*&f=json&token=XXX

 

 

https://XXX/server/rest/services/XXX/FeatureServer/0/query?where=1=1&outFields=*&f=json&token=XXX

 

 

 

...but as soon as I put them in my actualy query with relativepath the new one doesn't work.

(old: works)

    #"Added Custom - QUERY" = Table.AddColumn(#"Changed Type", "Custom.1", each Json.Document(Web.Contents("https://xxx/server",
    [
        RelativePath="rest/services/xxx/FeatureServer/0/query",
        Query=[
            where="1=1",
            outFields="*",
            resultOffset=[Column1],
            token=access_token1,
            f="json"
        ]
    ]
    ))),

 

 

(new: doesnt work)

    #"Added Custom - QUERY" = Table.AddColumn(#"Changed Type", "Custom.1", each Json.Document(Web.Contents("https://xxx/server",
    [
        RelativePath="rest/services/xxx/FeatureServer/0/query",
        Query=[
            where="tijdstip+>+DATE+'2023-06-29'",
            outFields="*",
            resultOffset=[Column1],
            token=access_token1,
            f="json"
        ]
    ]
    ))),

 

 

 

Does anyone know what I'm doing wrong?

 

Cheers,

Erik

 

1 ACCEPTED SOLUTION
ErikBI
Resolver I
Resolver I

Found the issue.

I had to replace all the + with space. 

 

   #"Added Custom - QUERY" = Table.AddColumn(#"Changed Type", "Custom.1", each Json.Document(Web.Contents("https://xxx/server",
    [
        RelativePath="rest/services/xxx/FeatureServer/0/query",
        Query=[
            where="tijdstip > DATE '2023-06-29'",
            outFields="*",
            resultOffset=[Column1],
            token=access_token1,
            f="json"
        ]
    ]
    ))),

 

 

View solution in original post

1 REPLY 1
ErikBI
Resolver I
Resolver I

Found the issue.

I had to replace all the + with space. 

 

   #"Added Custom - QUERY" = Table.AddColumn(#"Changed Type", "Custom.1", each Json.Document(Web.Contents("https://xxx/server",
    [
        RelativePath="rest/services/xxx/FeatureServer/0/query",
        Query=[
            where="tijdstip > DATE '2023-06-29'",
            outFields="*",
            resultOffset=[Column1],
            token=access_token1,
            f="json"
        ]
    ]
    ))),

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.