Using the Snoobi Datafeed with Microsoft PowerBI

Modified on Mon, 2 Feb at 11:09 AM

Snoobi Datafeed and PowerBI®


You can use the Snoobi Datafeed as JSON feed directly in Microsoft Power BI using Power Query (M).

Below are the two correct approaches, use the option that best suits your reporting needs.
Reference: Snoobi Datafeed and Parameters

Option 1: Simple REST call (when using static or fixed parameters)

Best to use when the Datafeed structure is fixed and parameters don’t need to change dynamically after publishing
(for instance when using the 'days' parameter)

Steps

1. Open Power BI Desktop

2. Select Home - Get Data - Web

3. Choose Advanced

4. Configure:

    URL

         Query Parameters:

         days - 14 (so always 14 days ending with today)

         maxrow - 1000 (if maxrow is needed, see your datafeed documentation)

5. Click OK

6. Power BI will detect JSON from the Snoobi Datafeed, then click Transform Data

7. Expand records into tabular data

Resulting M Code: - Note this may be preferred because Power BI treats parameters separately (this means better refresh & security)
Instead of the sample code below, use the Datafeed code you have received instead of the 2374... 

let
    BaseUrl = "https://data.snoobi.com/snoobidata/237423432843223423",
    Source = Json.Document(
        Web.Contents(
            BaseUrl,
            [
                Query = [
                    days = Text.From(Days),
                    maxrow = Text.From(MaxRow)
                ]
            ]
        )
    )
in
    Source


Option 2: Fully dynamic / parameter-driven feed (recommended for production)

This the better option when dates or the parameters change regularly, or you want to reuse across reports. This also works best if you want scheduled refresh to work reliably in the Power BI Service.


Step 1: Create Power BI Parameters

Home - Manage Parameters - New Parameter

Create:

    Days (Text or Number)

    MaxRow (Text or Number)
(Use your own Datafeed Parameters)

Step 2: Use Power Query Advanced Editor
Note this is the same code as in Option 1 but in Option 1 the values are treated as a Static Data Source
Option 1 is fine for: One-off reports or Fixed historical extracts, b
ut the limitation is that this is not reusable and not good for automation or date-driven refresh.

let
    BaseUrl = "https://data.snoobi.com/snoobidata/237423432843223423",
    Source = Json.Document(
        Web.Contents(
            BaseUrl,
            [
                Query = [
                    startdate = Text.From(Days),
                    maxrow = Text.From(MaxRow)
                ]
            ]
        )
    )
in
    Source

This will then survive a Power BI Service refresh and works with well scheduled refresh and gateway.


Step 3: Transforming the JSON into Tables

A typical pattern after loading looks like this:

  • Expand Record
  • Expand List
  • Convert to Table
  • Rename columns
  • Set data types


Example:

Table.FromRecords(Source[data])

Microsoft PowerBI is a trademark of Microsoft. Nothing in this document that implies Microsoft endorsed the Snoobi Datafeed, is affiliated with, or is otherwise connected with Snoobi Analytics.



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article