---
title: How can I optimize my Power BI reports to use less data?
description: Use incremental refresh and date filtering in Power BI so your Weever reports only request new data and use less OData.
---

[Skip to content](https://support.weeversoftware.com/optimize-reports#main-content)

[Submit a Support Issue](https://support.weeversoftware.com/kb-tickets/new?hsLang=en)

[![Weever-wordmark-darkgreen-4](https://support.weeversoftware.com/hs-fs/hubfs/Weever-wordmark-darkgreen-4.png?width=112&height=24&name=Weever-wordmark-darkgreen-4.png)](http://weeversoftware.com/)

Open main navigation

Close main navigation

- [Submit a Support Issue](https://support.weeversoftware.com/kb-tickets/new)

 How can we help you?

- There are no suggestions because the search field is empty.

1. [Weever Knowledge Base](https://support.weeversoftware.com/?hsLang=en)
2. [Power BI](https://support.weeversoftware.com/power-bi?hsLang=en)
3. [Reporting Tips](https://support.weeversoftware.com/power-bi?hsLang=en#reporting-tips)

# How can I optimize my Power BI reports to use less data?

## Use incremental refresh and date filtering with Weever's optimized Power Query templates, so each refresh only requests new data instead of everything you've already downloaded.

This document explains why Power BI reports can send far more OData requests than they need, and how to switch to optimized Power Query templates so each refresh only requests the data it actually needs (**new data**), not data that you have already downloaded from a previous refresh.

### ⚠️ The Problem

- **Too** many re**quests:** Standard filtering on OData in Power BI looked like it was working, but reports were still sending far too many requests to the OData service.
- **Why it happens:** With the standard OData connector, the date filter only reaches Weever through query folding. Our OData API supports folding on most tables and columns, but not all, and folding breaks easily when data is transformed too early in the query.
- **The result:** When folding breaks, the date range set by incremental refresh never reaches Weever. Power BI keeps requesting data outside the refresh window, so incremental refresh is not actually working.

### 🧠 Why Use the Optimized Templates?

- **Purpose:** Send only the OData requests that are actually needed, based on the date range set by incremental refresh.
- **How it works:** The template builds the request itself. The date filter, page size and page offset go straight into the request URL, so the service only returns rows for the window being refreshed.
- **No dependency on folding:** The `RangeStart` and `RangeEnd` filter is written into the request, so it reaches the service every time.

### Setup

#### Before you start: find your site name

Your site name is the first part of the web address you use to sign in to Weever, everything before `.weeverapps.com`.

Example: if you sign in at **sitename-001.weeverapps.com**, your site name is **sitename-001**.

When you paste a template, replace the whole placeholder, **curly brackets included**.

- ❌ `https://odata.weeverapps.com/v1/odata/v0/{sitename-001}/forms`
- ✅ `https://odata.weeverapps.com/v1/odata/v0/sitename-001/forms`

#### Step 1: Create two date parameters

In Power BI Desktop, select **Transform data**, then **Manage Parameters → New Parameter**. Create two parameters:

- Name: `RangeStart`, Type: **Date/Time**, Current value: `10/1/2025 12:00:00 AM`
- Name: `RangeEnd`, Type: **Date/Time**, Current value: `10/2/2025 12:00:00 AM`

The names must match exactly, including capital letters.

#### Step 2: Paste your template

Select **New Source → Blank Query**, then **Advanced Editor**. Delete what is there and paste the code for your table type below. Replace the text in curly brackets, remove the brackets, then select **Done**.

**Weever Forms tables:** Replace `{site}` with your Weever site name, and `{form_table_name}_{form_id}` with your full form table name, including the ID at the end. Remove the curly brackets.

Example: `{site}` becomes `sitename-001`, and `{form_table_name}_{form_id}` becomes `Daily_Safety_Check_12345`.

```
let    base_url = "https://odata.weeverapps.com/v1/odata/v0/{site}/forms",    relPath = "{form_table_name}_{form_id}",    PageSize = 5000,    KeyCols = {"_id"},    SortCol = "Form_Updated_Date",    startDate = DateTime.ToText(RangeStart, "yyyy-MM-ddTHH:mm:ssZ"),    endDate = DateTime.ToText(RangeEnd, "yyyy-MM-ddTHH:mm:ssZ"),    filter = "Form_Created_Date ge " & startDate & " and Form_Created_Date lt " & endDate,    Expected =        let            s = try Json.Document(Web.Contents(base_url, [RelativePath=relPath, Query=[#"$top"="1"]]))[value] otherwise {}        in            if List.Count(s) > 0            then List.Distinct(List.Combine(List.Transform(s, each Record.FieldNames(_))))            else {},    GetPage = (skip as number) as list =>        try            Json.Document(                Web.Contents(base_url, [                    RelativePath = relPath,                    Query = [                        #"$filter" = filter,                        #"$top" = Text.From(PageSize),                        #"$skip" = Text.From(skip)                    ]                ])            )[value]        otherwise {},    Pages =        List.Generate(            () => [skip=0, v=GetPage(0)],            each List.Count([v])>0,            each [skip=[skip]+PageSize, v=GetPage([skip]+PageSize)],            each [v]        ),    Rows = List.Combine(Pages),    AllFields =        if List.Count(Rows) = 0 then {}        else List.Distinct(List.Combine(List.Transform(Rows, each Record.FieldNames(_)))),    Cols = List.Distinct(Expected & AllFields),    Raw =        if List.Count(Cols) = 0 then #table({}, {})        else Table.FromRecords(Rows, Cols, MissingField.UseNull),    NoErrors = try Table.ReplaceErrorValues(Raw, List.Transform(Table.ColumnNames(Raw), each {_, null})) otherwise Raw,    Sorted =        if Table.HasColumns(NoErrors, SortCol)        then try Table.Sort(NoErrors, ) otherwise NoErrors        else NoErrors,    SafeDistinct = (tbl as table, keys as list) as table =>        let            present = List.Select(keys, each Table.HasColumns(tbl, _))        in            if List.Count(present) = 0 then try Table.Distinct(tbl) otherwise tbl            else try Table.Distinct(tbl, present) otherwise tbl,    T = SafeDistinct(Sorted, KeyCols),    Final =        let            SafeTypeCol = (tbl as table, col as text) as table =>                let                    sample = List.First(List.RemoveNulls(Table.Column(tbl, col)), null),                    targetType =                        if sample is list or sample is record then type any                        else if sample is datetimezone then type datetimezone                        else if sample is datetime then type datetime                        else if sample is date then type date                        else if sample is number then type number                        else if sample is logical then type logical                        else if sample is text then type text                        else type any,                    result = try Table.TransformColumnTypes(tbl, ) otherwise tbl                in                    result,            TypedT = List.Accumulate(Table.ColumnNames(T), T, (s, c) => SafeTypeCol(s, c))        in            if List.Count(Expected) = 0            then TypedT            else Table.SelectColumns(TypedT, Expected, MissingField.UseNull)in    Final
```

**Weever Inspections Tables:** Replace `{site}` with your Weever site name and remove the curly brackets. Change `ScheduledInspections` to your inspection table name if it's different.

Example: `{site}` becomes `sitename-001`.

```
let    base_url = "https://odata.weeverapps.com/v1/odata/v1/{site}/inspections",    relPath = "ScheduledInspections",    PageSize = 5000,    KeyCols = {"InspectionId"},    startDate = DateTime.ToText(RangeStart, "yyyy-MM-ddTHH:mm:ssZ"),    endDate = DateTime.ToText(RangeEnd, "yyyy-MM-ddTHH:mm:ssZ"),    filter = "DueAt ge " & startDate & " and DueAt lt " & endDate,    Expected =        let            s = try Json.Document(Web.Contents(base_url, [RelativePath=relPath, Query=[#"$top"="1"]]))[value] otherwise {}        in            if List.Count(s) > 0            then List.Distinct(List.Combine(List.Transform(s, each Record.FieldNames(_))))            else {},    GetPage = (skip as number) as list =>        try            Json.Document(                Web.Contents(base_url, [                    RelativePath = relPath,                    Query = [                        #"$filter" = filter,                        #"$top" = Text.From(PageSize),                        #"$skip" = Text.From(skip)                    ]                ])            )[value]        otherwise {},    Pages =        List.Generate(            () => [skip=0, v=GetPage(0)],            each List.Count([v])>0,            each [skip=[skip]+PageSize, v=GetPage([skip]+PageSize)],            each [v]        ),    Rows = List.Combine(Pages),    AllFields = if List.Count(Rows) = 0 then {}        else List.Distinct(List.Combine(List.Transform(Rows, each Record.FieldNames(_)))),    Cols = List.Distinct(Expected & AllFields),    Raw =        if List.Count(Cols) = 0 then #table({}, {})        else Table.FromRecords(Rows, Cols, MissingField.UseNull),    NoErrors = try Table.ReplaceErrorValues(Raw, List.Transform(Table.ColumnNames(Raw), each {_, null})) otherwise Raw,    SafeDistinct = (tbl as table, keys as list) as table =>        let            present = List.Select(keys, each Table.HasColumns(tbl, _))        in            if List.Count(present) = 0 then try Table.Distinct(tbl) otherwise tbl            else try Table.Distinct(tbl, present) otherwise tbl,    T = SafeDistinct(NoErrors, KeyCols),    Final =        let            SafeTypeCol = (tbl as table, col as text) as table =>                let                    sample = List.First(List.RemoveNulls(Table.Column(tbl, col)), null),                    targetType =                        if sample is list or sample is record then type any                        else if sample is datetimezone then type datetimezone                        else if sample is datetime then type datetime                        else if sample is date then type date                        else if sample is number then type number                        else if sample is logical then type logical                        else if sample is text then type text                        else type any,                    result = try Table.TransformColumnTypes(tbl, ) otherwise tbl                in                    result,            TypedT = List.Accumulate(Table.ColumnNames(T), T, (s, c) => SafeTypeCol(s, c))        in            if List.Count(Expected) = 0            then TypedT            else Table.SelectColumns(TypedT, Expected, MissingField.UseNull)in    Final
```

**Weever Process by Form Name:** Replace `{site}` with your Weever site name, and `{form_name_prefix}` with the start of the form's table name. Remove the curly brackets, and keep the `_` at the end.

Example: the base URL becomes `https://sitename-001.pm.weeverapps.com/v1/odata/v1/process`, and the name prefix becomes `Daily_Safety_Check_`.

*Note: Use Form ID (outlined below) if the form might be renamed.*

```
let    base_url = "https://{site}.pm.weeverapps.com/v1/odata/v1/process",    namePrefix = "{form_name_prefix}_",    PageSize = 5000,    startDate = DateTime.ToText(RangeStart, "yyyy-MM-ddTHH:mm:ssZ"),    endDate = DateTime.ToText(RangeEnd, "yyyy-MM-ddTHH:mm:ssZ"),    filter = "CreatedAt ge " & startDate & " and CreatedAt lt " & endDate,    EntityList =        let            raw = try Json.Document(Web.Contents(base_url, [Query=[]]))[value] otherwise [],            names = List.Transform(raw, each Record.Field(_, "name"))        in List.Select(names, each Text.StartsWith(_, namePrefix)),    GetPage = (relPath as text, skip as number) as list =>        try Json.Document(Web.Contents(base_url, [RelativePath=relPath, Query=[#"$filter"=filter, #"$top"=Text.From(PageSize), #"$skip"=Text.From(skip)]]))[value]        otherwise {},    FetchAllPages = (relPath as text) as list =>        List.Combine(List.Generate(            () => [skip=0, v=GetPage(relPath, 0)],            each List.Count([v]) > 0,            each [skip=[skip]+PageSize, v=GetPage(relPath, [skip]+PageSize)],            each [v]        )),    AllRecords = List.Combine(List.Transform(EntityList, each FetchAllPages(_))),    Expected =        if List.Count(AllRecords) = 0 then            let s = try Json.Document(Web.Contents(base_url, [RelativePath=List.Last(EntityList,""), Query=[#"$top"="1"]]))[value] otherwise {}            in if List.Count(s) > 0 then Table.ColumnNames(Table.FromRecords(s)) else {}        else Table.ColumnNames(Table.FromRecords({List.First(AllRecords)})),    NullRecord = Record.FromList(List.Repeat({null}, List.Count(Expected)), Expected),    raw =        if List.Count(AllRecords) = 0 then            Table.RemoveFirstN(Table.FromRecords({NullRecord}), 1)        else            Table.FromRecords(                List.Transform(AllRecords, (rec) =>                    Record.ReorderFields(                        Record.SelectFields(Record.Combine({NullRecord, rec}), Expected, MissingField.UseNull),                        Expected                    )                )            ),    Sorted = if Table.HasColumns(raw, "CreatedAt") then Table.Sort(raw, ) else raw,    T = Table.Distinct(        if Table.HasColumns(Sorted, "Id") then Table.TransformColumnTypes(Sorted, ) else Sorted,        if Table.HasColumns(Sorted, "Id") then {"Id"} else {}    ),    Final =        let            cols = Table.ColumnNames(T),            SafeTypeCol = (tbl as table, col as text) as table =>                let                    sample = List.First(List.RemoveNulls(Table.Column(tbl, col)), null),                    targetType =                        if sample is list or sample is record then type any                        else if sample is datetimezone then type datetimezone                        else if sample is datetime then type datetime                        else if sample is date then type date                        else if sample is number then type number                        else if sample is logical then type logical                        else if sample is text then type text                        else type any,                    result = try Table.TransformColumnTypes(tbl, ) otherwise tbl                in                    result,            TypedT = List.Accumulate(cols, T, (s, c) => SafeTypeCol(s, c))        in            if List.Count(Expected) = 0 then TypedT else            Table.SelectColumns(                List.Accumulate(Expected, TypedT, (s, c) => if Table.HasColumns(s, c) then s else Table.AddColumn(s, c, each null)),                Expected, MissingField.UseNull            )in    Final
```

**Weever Process by Form ID:** Replace `{site}` with your Weever site name, and `{form_id}` with the form ID. Remove the curly brackets, and keep the `_` in front of the ID.

Example: the base URL becomes `https://sitename-001.pm.weeverapps.com/v1/odata/v1/process`, and the name prefix becomes `_12345`.

```
let    base_url = "https://{site}.pm.weeverapps.com/v1/odata/v1/process",    namePrefix = "_{form_id}",    PageSize = 5000,    startDate = DateTime.ToText(RangeStart, "yyyy-MM-ddTHH:mm:ssZ"),    endDate = DateTime.ToText(RangeEnd, "yyyy-MM-ddTHH:mm:ssZ"),    filter = "CreatedAt ge " & startDate & " and CreatedAt lt " & endDate,    EntityList =        let            raw = try Json.Document(Web.Contents(base_url, [Query=[]]))[value] otherwise [],            names = List.Transform(raw, each Record.Field(_, "name"))        in List.Select(names, each Text.EndsWith(_, namePrefix)),    GetPage = (relPath as text, skip as number) as list =>        try Json.Document(Web.Contents(base_url, [RelativePath=relPath, Query=[#"$filter"=filter, #"$top"=Text.From(PageSize), #"$skip"=Text.From(skip)]]))[value]        otherwise {},    FetchAllPages = (relPath as text) as list =>        List.Combine(List.Generate(            () => [skip=0, v=GetPage(relPath, 0)],            each List.Count([v]) > 0,            each [skip=[skip]+PageSize, v=GetPage(relPath, [skip]+PageSize)],            each [v]        )),    AllRecords = List.Combine(List.Transform(EntityList, each FetchAllPages(_))),    Expected =        if List.Count(AllRecords) = 0 then            let s = try Json.Document(Web.Contents(base_url, [RelativePath=List.Last(EntityList,""), Query=[#"$top"="1"]]))[value] otherwise {}            in if List.Count(s) > 0 then Table.ColumnNames(Table.FromRecords(s)) else {}        else Table.ColumnNames(Table.FromRecords({List.First(AllRecords)})),    NullRecord = Record.FromList(List.Repeat({null}, List.Count(Expected)), Expected),    raw =        if List.Count(AllRecords) = 0 then            Table.RemoveFirstN(Table.FromRecords({NullRecord}), 1)        else            Table.FromRecords(                List.Transform(AllRecords, (rec) =>                    Record.ReorderFields(                        Record.SelectFields(Record.Combine({NullRecord, rec}), Expected, MissingField.UseNull),                        Expected                    )                )            ),    Sorted = if Table.HasColumns(raw, "CreatedAt") then Table.Sort(raw, ) else raw,    T = Table.Distinct(        if Table.HasColumns(Sorted, "Id") then Table.TransformColumnTypes(Sorted, ) else Sorted,        if Table.HasColumns(Sorted, "Id") then {"Id"} else {}    ),    Final =        let            cols = Table.ColumnNames(T),            SafeTypeCol = (tbl as table, col as text) as table =>                let                    sample = List.First(List.RemoveNulls(Table.Column(tbl, col)), null),                    targetType =                        if sample is list or sample is record then type any                        else if sample is datetimezone then type datetimezone                        else if sample is datetime then type datetime                        else if sample is date then type date                        else if sample is number then type number                        else if sample is logical then type logical                        else if sample is text then type text                        else type any,                    result = try Table.TransformColumnTypes(tbl, ) otherwise tbl                in                    result,            TypedT = List.Accumulate(cols, T, (s, c) => SafeTypeCol(s, c))        in            if List.Count(Expected) = 0 then TypedT else            Table.SelectColumns(                List.Accumulate(Expected, TypedT, (s, c) => if Table.HasColumns(s, c) then s else Table.AddColumn(s, c, each null)),                Expected, MissingField.UseNull            )in    Final
```

You should see rows from your test dates. Select **Close & Apply**.

#### Step 3: Turn on incremental refresh

In the **Data** pane, right-click your table and select **Incremental refresh**. Turn it on, then set:

- **Archive data starting:** how far back to keep data, such as 10 years
- **Incrementally refresh data starting:** how much recent data to reload each time, such as 30 days

##### 📝 Note!

- The first refresh in the Service loads all your history, so it will be slow. Later refreshes should be much faster.
- If Power BI warns that it can't confirm the query folds when you turn on incremental refresh, you can ignore it.

#### If refreshes are still slow

In the Service, open your semantic model's **Settings → Refresh history**. If every refresh takes as long as the first one, check:

- The parameters are named exactly `RangeStart` and `RangeEnd` and set to **Date/Time**.
- Incremental refresh is turned on for this table.
- You haven't added steps to the template's code. Do any extra changes in a separate query that references this one.
- If the preview shows columns called `name` and `url` instead of your data, the `namePrefix` doesn't match any table. Check the spelling.
- If you get an error or no rows, check that you removed all the curly brackets and that your site name matches your Weever web address.

[![Weever-wordmark-darkgreen-4](https://support.weeversoftware.com/hs-fs/hubfs/Weever-wordmark-darkgreen-4.png?width=234&height=50&name=Weever-wordmark-darkgreen-4.png "Weever-wordmark-darkgreen-4")](https://weeverapps.com)

Weever Knowledge Base

<https://www.facebook.com/WeeverApps/> <https://www.linkedin.com/company/weever-apps-inc->

Copyright © 2026, Weever