Contains JavaScript & TypeScript object models for Microsoft Power BI JavaScript SDK
Перейти к файлу
Or Shemesh 4bbc2004f7
Merge pull request #94 from microsoft/readme_support_links
Update README.md with correct support links
2024-10-14 16:46:51 +03:00
src Merged PR 497159: [CustomVisuals] - HierarchyIdentityFilter 2024-03-20 11:55:26 +00:00
test Merged PR 487945: Extend Include Exclude filter to support multi targets get 2023-12-19 20:10:01 +00:00
.eslintignore Merge remote-tracking branch 'powerbi/master' into release-1.10.1 2022-05-31 16:16:27 +03:00
.eslintrc.js Merge remote-tracking branch 'powerbi/master' into release-1.10.1 2022-05-31 16:16:27 +03:00
.gitignore Merge remote-tracking branch 'powerbi/master' into release-1.10.1 2022-05-31 16:16:27 +03:00
.travis.yml skip cleanup to ensure npm modules exists. 2017-10-15 16:16:32 +03:00
CONTRIBUTING.md Merged PR 130054: [powerbi-models]: Make master up-to-date with portal 2020-11-30 04:57:39 +00:00
LICENSE.txt Initial Commit of powerbi-models. Has interfaces which are shared between host and iframe code. 2016-06-23 11:34:44 -07:00
README.md Update README.md with correct support links 2024-10-14 15:11:20 +03:00
SECURITY.md merge 2021-06-20 15:02:35 +03:00
gulpfile.js Merge remote-tracking branch 'powerbi/master' into release-1.10.1 2022-05-31 16:16:27 +03:00
karma.conf.js Merged PR 312627: Upgrade karma to use Chrome instead of Phantom JS for powerbi-models 2022-11-09 07:18:50 +00:00
package-lock.json Merged PR 536168: Bump to version 1.15.2 2024-03-21 14:40:03 +00:00
package.json Merge remote-tracking branch 'powerbi/master' into release-1.15.2 2024-03-25 11:34:36 +00:00
tsconfig.json Merged PR 130054: [powerbi-models]: Make master up-to-date with portal 2020-11-30 04:57:39 +00:00
typings.json Merged PR 130054: [powerbi-models]: Make master up-to-date with portal 2020-11-30 04:57:39 +00:00
webpack.config.js initial commit 2020-12-30 09:10:30 +02:00
webpack.test.config.js merge 2021-06-20 15:02:35 +03:00
webpack.test.tsconfig.json Merge remote-tracking branch 'powerbi/master' into release-1.10.1 2022-05-31 16:16:27 +03:00

README.md

powerbi-models

Build Status NPM Version NPM Total Downloads NPM Monthly Downloads GitHub tag

Contains JavaScript & 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

Getting Started

Install

npm install --save powerbi-models

Import

import * as models from 'powerbi-models';

Usage

Validation:

let testObject = { x: 1 };

const errors = models.validateLoad(testObject);

if(errors) {
  console.warn(errors);
}

Would output to the console:

[
  {
    message: 'accessToken is required'
  }
]

Creating filters:

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:

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 standard. Example: 2016-09-08T00:15:46.861Z

This is how dates are naturally serialized to JSON:

new Date().toJSON(); //=> 2016-09-08T00:15:46.861Z

An example filter using this Date format would look like the following:

{
  "$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, where you can also vote on ideas from other developers.
  • Bug Reports and Technical Assistance: Visit the Fabric Developer Community Forum. Our team and community experts are ready to assist you.
  • Additional Support: Contact your account manager or reach out to the Fabric Support Team.