# powerbi-models

> Contains JavaScript &amp; TypeScript object models for Microsoft Power BI JavaScript SDK. For each model there is a TypeScript interface, and a validation function to ensure and object is valid.

Latest version **2.2.0** (published 2026-09-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install powerbi-models
pnpm add powerbi-models
yarn add powerbi-models
bun add powerbi-models
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2026-09-23 |
| First published | 2016-06-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 716.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 54 |
| Author | Microsoft PowerBI Team |
| Maintainers | microsoft1es, microsoft-oss-releases, powerbi |
| Keywords | Microsoft, PowerBI, message, validation, json |

## Links

- npm: https://www.npmjs.com/package/powerbi-models
- Repository: https://github.com/Microsoft/powerbi-models
- Homepage: https://github.com/Microsoft/powerbi-models#readme
- Issues: https://github.com/Microsoft/powerbi-models/issues
- npm.io page: https://npm.io/package/powerbi-models

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 2.2.0 (latest) — 2026-09-23
- 2.1.1 — 2026-07-07
- 2.1.0 — 2026-07-06
- 2.0.1 — 2025-10-08
- 1.15.3 — 2024-11-29
- 1.15.2 — 2024-03-25
- 1.14.1 — 2024-01-29
- 1.14.0 — 2023-11-30
- 1.13.0 — 2023-09-07
- 1.12.6 — 2023-02-14
- 1.12.5 — 2023-02-06
- 1.12.4 — 2023-01-25
- 1.12.3 — 2022-11-20
- 1.12.1 — 2022-09-11
- 1.12.0 — 2022-08-28
- … 65 more at https://npm.io/package/powerbi-models/versions

## README

# powerbi-models

[![Build Status](https://img.shields.io/travis/Microsoft/powerbi-models.svg)](https://travis-ci.org/Microsoft/powerbi-models)
[![NPM Version](https://img.shields.io/npm/v/powerbi-models.svg)](https://www.npmjs.com/package/powerbi-models)
[![NPM Total Downloads](https://img.shields.io/npm/dt/powerbi-models.svg)](https://www.npmjs.com/package/powerbi-models)
[![NPM Monthly Downloads](https://img.shields.io/npm/dm/powerbi-models.svg)](https://www.npmjs.com/package/powerbi-models)
[![GitHub tag](https://img.shields.io/github/tag/microsoft/powerbi-models.svg)](https://github.com/Microsoft/powerbi-models/tags)

Contains JavaScript &amp; TypeScript object models for Microsoft Power BI JavaScript SDK.

For each model there is a TypeScript interface, a json schema definitions, and a validation function to ensure a given object is a valid model.

## Documentation

### [https://microsoft.github.io/powerbi-models](https://microsoft.github.io/powerbi-models)

## Getting Started

Install

```bash
npm install --save powerbi-models
```

Import

```typescript
import * as models from 'powerbi-models';
```

Usage

Validation:

```typescript
let testObject = { x: 1 };

const errors = models.validateLoad(testObject);

if(errors) {
  console.warn(errors);
}

```

Would output to the console:

```typescript
[
  {
    message: 'accessToken is required'
  }
]
```

Creating filters:

```typescript
const basicFilter: models.IBasicFilter = {
  target: {
    table: "Products",
    column: "Version"
  },
  operator: "In",
  values: [
    1,
    2,
    3,
    4
  ]
};

const advancedFilter: models.IAdvancedFilter = {
  target: {
    table: "Products",
    column: "Name"
  },
  logicalOperator: "Or",
  conditions: [
    {
      operator: "Contains",
      value: "Power"
    },
    {
      operator: "Contains",
      value: "Microsoft"
    }
  ]
};
```

Or use the constructor methods:

```typescript
const advancedFilter = new models.AdvancedFilter(
  {
    table: "Products",
    column: "Name"
  },
  "Or",
  {
    operator: "Contains",
    value: "Power"
  },
  {
    operator: "Contains",
    value: "Microsoft"
  }
);
```

## Date Formatting

Dates should be formated using [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. Example: `2016-09-08T00:15:46.861Z`

This is how dates are naturally serialized to JSON:

```typescript
new Date().toJSON(); //=> 2016-09-08T00:15:46.861Z
```

An example filter using this Date format would look like the following:

```JSON
{
  "$schema": "http://powerbi.com/product/schema#advanced",
  "target": {
    "table": "Time",
    "column": "Date"
  },
  "logicalOperator": "And",
  "conditions": [
    {
      "operator": "GreaterThan",
      "value": "2014-06-01T07:00:00.000Z"
    }
  ]
}
```

## Support

- **Feature Requests:** Submit your ideas and suggestions to the [Fabric Ideas Portal](https://ideas.fabric.microsoft.com/), where you can also vote on ideas from other developers.
- **Bug Reports and Technical Assistance:** Visit the [Fabric Developer Community Forum](https://community.fabric.microsoft.com/t5/Developer/bd-p/Developer). Our team and community experts are ready to assist you.
- **Additional Support:** Contact your account manager or reach out to the [Fabric Support Team](https://support.fabric.microsoft.com/en-us/support/).

---
_Source: https://npm.io/package/powerbi-models · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
