Información sobre las asignaciones de vistas de datos en objetos visuales de Power BIUnderstand data view mapping in Power BI visuals
En este artículo se explica la asignación de vista de datos, se describe cómo se relacionan los roles de datos entre sí y le permite especificar requisitos condicionales para estos.This article discusses data view mapping and describes how data roles relate to each other and allow you to specify conditional requirements for them. En el artículo también se describe cada tipo de dataMappings
.The article also describes each dataMappings
type.
Cada asignación válida genera una vista de datos, pero actualmente solo se permite ejecutar una consulta por objeto visual.Each valid mapping produces a data view, but we currently support performing only one query per visual. Normalmente, solo obtiene una vista de datos,You ordinarily get only one data view. pero puede proporcionar varias asignaciones de datos en determinadas condiciones, lo que permite lo siguiente:However, you can provide multiple data mappings in certain conditions, which allow:
"dataViewMappings": [
{
"conditions": [ ... ],
"categorical": { ... },
"single": { ... },
"table": { ... },
"matrix": { ... }
}
]
Power BI solo creará una asignación a una vista de datos si la asignación válida se rellena en dataViewMappings
.Power BI creates a mapping to a data view if and only if the valid mapping is filled in dataViewMappings
.
En otras palabras, categorical
podría definirse en dataViewMappings
, pero otras asignaciones, como table
o single
, podrían no estar definidas.In other words, categorical
might be defined in dataViewMappings
but other mappings, such as table
or single
, might not be. Por ejemplo:For example:
"dataViewMappings": [
{
"categorical": { ... }
}
]
Power BI genera una vista de datos con una sola asignación categorical
, y table
y otras asignaciones no están definidas:Power BI produces a data view with a single categorical
mapping, and table
and other mappings are undefined:
{
"categorical": {
"categories": [ ... ],
"values": [ ... ]
},
"metadata": { ... }
}
CondicionesConditions
En esta sección se describen las condiciones de una asignación de datos específica.This section describes conditions for a particular data mapping. Puede proporcionar varios conjuntos de condiciones y, si los datos coinciden con uno de los conjuntos de condiciones descritos, el objeto visual acepta los datos como válidos.You can provide multiple sets of conditions and, if the data matches one of the described sets of conditions, the visual accepts the data as valid.
Actualmente, se puede especificar un valor mínimo y máximo para cada campo.Currently, for each field, you can specify a minimum and maximum value. El valor representa el número de campos que pueden estar enlazados a ese rol de datos.The value represents the number of fields that can be bound to that data role.
Nota
Si se omite un rol de datos en la condición, puede tener cualquier número de campos.If a data role is omitted in the condition, it can have any number of fields.
Ejemplo 1Example 1
Puede arrastrar varios campos a cada rol de datos.You can drag multiple fields into each data role. En este ejemplo, limitará la categoría a un campo de datos y la medida a dos campos de datos.In this example, you limit the category to one data field and the measure to two data fields.
"conditions": [
{ "category": { "max": 1 }, "y": { "max": 2 } },
]
Ejemplo 2Example 2
En este ejemplo, se necesita una de estas dos condiciones:In this example, either of two conditions is required:
- Exactamente un campo de datos de categoría y exactamente dos medidas.Exactly one category data field and exactly two measures
- Exactamente dos categorías y exactamente una medida.Exactly two categories and exactly one measure.
"conditions": [
{ "category": { "min": 1, "max": 1 }, "measure": { "min": 2, "max": 2 } },
{ "category": { "min": 2, "max": 2 }, "measure": { "min": 1, "max": 1 } }
]
Asignación de datos únicaSingle data mapping
La asignación de datos única es la forma más simple de asignación de datos.Single data mapping is the simplest form of data mapping. Admite un solo campo de medida y proporciona el total.It accepts a single measure field and gives you the total. Si el campo es numérico, proporciona la suma.If the field is numeric, it gives you the sum. De lo contrario, proporciona un recuento de valores únicos.Otherwise, it gives you a count of unique values.
Para usar la asignación de datos única, es necesario definir el nombre del rol de datos que quiera asignar.To use single data mapping, you need to define the name of the data role that you want to map. Esta asignación solo funciona con un único campo de medida.This mapping works only with a single measure field. Si se asigna un segundo campo, no se genera ninguna vista de datos, por lo que también es recomendable incluir una condición que limite los datos a un solo campo.If a second field is assigned, no data view is generated, so it's also a good practice to include a condition that limits the data to a single field.
Nota
Esta asignación de datos no se puede usar con ninguna otra asignación de datos.This data mapping can't be used in conjunction with any other data mapping. Su objetivo es reducir los datos a un único valor numérico.It's meant to reduce data into a single numeric value.
Ejemplo 3Example 3
{
"dataRoles": [
{
"displayName": "Y",
"name": "Y",
"kind": "Measure"
}
],
"dataViewMappings": [
{
"conditions": [
{
"Y": {
"max": 1
}
}
],
"single": {
"role": "Y"
}
}
]
}
La vista de datos resultante sigue conteniendo los otros tipos (tabla, categórico, etc.), pero cada asignación solo contiene el valor único.The resulting data view still contains the other types (table, categorical, and so on), but each mapping contains only the single value. El procedimiento recomendado es acceder solo al valor único.The best practice is to access the value only in single.
{
"dataView": [
{
"metadata": null,
"categorical": null,
"matrix": null,
"table": null,
"tree": null,
"single": {
"value": 94163140.3560001
}
}
]
}
Ejemplo de código para procesar una asignación de vista de datos simpleCode sample to process simple data view mapping
"use strict";
import powerbi from "powerbi-visuals-api";
import DataView = powerbi.DataView;
import DataViewSingle = powerbi.DataViewSingle;
// standart imports
// ...
export class Visual implements IVisual {
private target: HTMLElement;
private host: IVisualHost;
private valueText: HTMLParagraphElement;
constructor(options: VisualConstructorOptions) {
// constructor body
this.target = options.element;
this.host = options.host;
this.valueText = document.createElement("p");
this.target.appendChild(this.valueText);
// ...
}
public update(options: VisualUpdateOptions) {
const dataView: DataView = options.dataViews[0];
const singleDataView: DataViewSingle = dataView.single;
if (!singleDataView ||
!singleDataView.value ) {
return
}
this.valueText.innerText = singleDataView.value.toString();
}
}
Como resultado, el objeto visual muestra un valor único de Power BI:As a result the visual displays a single value from Power BI:
Asignación de datos categóricosCategorical data mapping
La asignación de datos categóricos se usa para obtener una o dos agrupaciones de datos independientes.Categorical data mapping is used to get one or two independent groupings of data.
Ejemplo 4Example 4
Esta es la definición del ejemplo anterior de los roles de datos:Here is the definition from the previous example for data roles:
"dataRole":[
{
"displayName": "Category",
"name": "category",
"kind": "Grouping"
},
{
"displayName": "Y Axis",
"name": "measure",
"kind": "Measure"
}
]
Esta es la asignación:Here is the mapping:
"dataViewMappings": {
"categorical": {
"categories": {
"for": { "in": "category" }
},
"values": {
"select": [
{ "bind": { "to": "measure" } }
]
}
}
}
Es un ejemplo sencillo.It's a simple example. Dice lo siguiente: "Quiero asignar mi rol de datos category
para que, en todos los campos que arrastre a category
, sus datos se asignen a categorical.categories
.It reads "Map my category
data role so that for every field I drag into category
, its data is mapped to categorical.categories
. Además, también quiero asignar mi rol de datos measure
a categorical.values
".Also map my measure
data role to categorical.values
."
- for...in: quiero que se incluyan en la consulta de datos todos los elementos de este rol de datos.for...in: For all the items in this data role, include them in the data query.
- bind...to: produce el mismo resultado que for...in, pero espera que el rol de datos tenga una condición que lo restrinja a un único campo.bind...to: Produces the same result as in for...in, but expects that the data role will have a condition restricting it to a single field.
Ejemplo 5Example 5
En este ejemplo, se usan los dos primeros roles de datos del ejemplo anterior y, además, se definen grouping
y measure2
.This example uses the first two data roles from the previous example and additionally defines grouping
and measure2
.
"dataRole":[
{
"displayName": "Category",
"name": "category",
"kind": "Grouping"
},
{
"displayName": "Y Axis",
"name": "measure",
"kind": "Measure"
},
{
"displayName": "Grouping with",
"name": "grouping",
"kind": "Grouping"
},
{
"displayName": "X Axis",
"name": "measure2",
"kind": "Grouping"
}
]
Esta es la asignación:Here is the mapping:
"dataViewMappings":{
"categorical": {
"categories": {
"for": { "in": "category" }
},
"values": {
"group": {
"by": "grouping",
"select":[
{ "bind": { "to": "measure" } },
{ "bind": { "to": "measure2" } }
]
}
}
}
}
Aquí, la diferencia es la forma en que asignamos valores categóricos.Here the difference is in how we are mapping categorical.values. Decimos lo siguiente: "Quiero asignar los roles de datos measure
y measure2
para que se agrupen según el rol de datos grouping
".We are saying that "Map my measure
and measure2
data roles to be grouped by the data role grouping
."
Ejemplo 6Example 6
Estos son los roles de datos:Here are the data roles:
"dataRoles": [
{
"displayName": "Categories",
"name": "category",
"kind": "Grouping"
},
{
"displayName": "Measures",
"name": "measure",
"kind": "Measure"
},
{
"displayName": "Series",
"name": "series",
"kind": "Measure"
}
]
Esta es la asignación de vista de datos:Here is the data view mapping:
"dataViewMappings": [
{
"categorical": {
"categories": {
"for": {
"in": "category"
}
},
"values": {
"group": {
"by": "series",
"select": [{
"for": {
"in": "measure"
}
}
]
}
}
}
}
]
La vista de datos categóricos podrían visualizarse de esta forma:The categorical data view could be visualized like this:
PaísCountry | 20132013 | 20142014 | 20152015 | 20162016 |
---|---|---|---|---|
EE. UU.USA | xx | xx | 650650 | 350350 |
CanadáCanada | xx | 630630 | 490490 | xx |
MéxicoMexico | 645645 | xx | xx | xx |
Reino UnidoUK | xx | xx | 831831 | xx |
Power BI lo genera como la vista de datos categóricos.Power BI produces it as the categorical data view. Es el conjunto de categorías.It's the set of categories.
{
"categorical": {
"categories": [
{
"source": {...},
"values": [
"Canada",
"USA",
"UK",
"Mexico"
],
"identity": [...],
"identityFields": [...],
}
]
}
}
Cada categoría también se asigna a un conjunto de valores.Each category maps to a set of values as well. Cada uno de estos valores se agrupa por series, que se expresan como años.Each of these values is grouped by series, which is expressed as years.
Por ejemplo, cada matriz de values
representa datos de cada año.For example, each values
array represents data for each year.
Además, cada matriz de values
tiene 4 valores (para Canadá, EE. UU., Reino Unido y México, respectivamente):Also each values
array has 4 values, for Canada, USA, UK and Mexico respectively:
{
"values": [
// Values for 2013 year
{
"source": {...},
"values": [
null, // Value for `Canada` category
null, // Value for `USA` category
null, // Value for `UK` category
645 // Value for `Mexico` category
],
"identity": [...],
},
// Values for 2014 year
{
"source": {...},
"values": [
630, // Value for `Canada` category
null, // Value for `USA` category
null, // Value for `UK` category
null // Value for `Mexico` category
],
"identity": [...],
},
// Values for 2015 year
{
"source": {...},
"values": [
490, // Value for `Canada` category
650, // Value for `USA` category
831, // Value for `UK` category
null // Value for `Mexico` category
],
"identity": [...],
},
// Values for 2016 year
{
"source": {...},
"values": [
null, // Value for `Canada` category
350, // Value for `USA` category
null, // Value for `UK` category
null // Value for `Mexico` category
],
"identity": [...],
}
]
}
A continuación se describe el ejemplo de código para procesar una asignación de vistas de datos categóricas.Code sample for processing categorical data view mapping is described below. En el ejemplo se crea la estructura jerárquica Country => Year => Value
The sample creates Hierarchical structure Country => Year => Value
"use strict";
import powerbi from "powerbi-visuals-api";
import DataView = powerbi.DataView;
import DataViewDataViewCategoricalSingle = powerbi.DataViewCategorical;
import DataViewValueColumnGroup = powerbi.DataViewValueColumnGroup;
import PrimitiveValue = powerbi.PrimitiveValue;
// standart imports
// ...
export class Visual implements IVisual {
private target: HTMLElement;
private host: IVisualHost;
private categories: HTMLElement;
constructor(options: VisualConstructorOptions) {
// constructor body
this.target = options.element;
this.host = options.host;
this.categories = document.createElement("pre");
this.target.appendChild(this.categories);
// ...
}
public update(options: VisualUpdateOptions) {
const dataView: DataView = options.dataViews[0];
const categoricalDataView: DataViewCategorical = dataView.categorical;
if (!categoricalDataView ||
!categoricalDataView.categories ||
!categoricalDataView.categories[0] ||
!categoricalDataView.values) {
return;
}
// Categories have only one column in data buckets
// If you want to support several columns of categories data bucket, you should iterate categoricalDataView.categories array.
const categoryFieldIndex = 0;
// Measure has only one column in data buckets.
// If you want to support several columns on data bucket, you should iterate years.values array in map function
const measureFieldIndex = 0;
let categories: PrimitiveValue[] = categoricalDataView.categories[categoryFieldIndex].values;
let values: DataViewValueColumnGroup[] = categoricalDataView.values.grouped();
let data = {};
// iterate categories/countries
categories.map((category: PrimitiveValue, categoryIndex: number) => {
data[category.toString()] = {};
// iterate series/years
values.map((years: DataViewValueColumnGroup) => {
if (!data[category.toString()][years.name] && years.values[measureFieldIndex].values[categoryIndex]) {
data[category.toString()][years.name] = []
}
if (years.values[0].values[categoryIndex]) {
data[category.toString()][years.name].push(years.values[measureFieldIndex].values[categoryIndex]);
}
});
});
this.categories.innerText = JSON.stringify(data, null, 6);
console.log(data);
}
}
El resultado del objeto visual es el siguiente:The result of the visual:
Asignación de datos de tablaTable data mapping
La vista de datos de tabla es una asignación de datos sencilla.The table data view is a simple data mapping. Básicamente, es una lista de puntos de datos donde se pueden agregar puntos de datos numéricos.Essentially, it's a list of data points, where numeric data points could be aggregated.
Ejemplo 7Example 7
Con las funciones especificadas:With the given capabilities:
"dataRoles": [
{
"displayName": "Column",
"name": "column",
"kind": "Grouping"
},
{
"displayName": "Value",
"name": "value",
"kind": "Measure"
}
]
"dataViewMappings": [
{
"table": {
"rows": {
"select": [
{
"for": {
"in": "column"
}
},
{
"for": {
"in": "value"
}
}
]
}
}
}
]
Puede visualizar la vista de datos de tabla como se muestra a continuación:You can visualize the table data view as the following:
Ejemplo de datos:Data example:
PaísCountry | YearYear | SalesSales |
---|---|---|
EE. UU.USA | 20162016 | 100100 |
EE. UU.USA | 20152015 | 5050 |
CanadáCanada | 20152015 | 200200 |
CanadáCanada | 20152015 | 5050 |
MéxicoMexico | 20132013 | 300300 |
Reino UnidoUK | 20142014 | 150150 |
EE. UU.USA | 20152015 | 7575 |
Enlace de datos:Data binding:
Power BI muestra los datos como la vista de datos de tabla.Power BI displays your data as the table data view. No debe asumir que los datos están ordenados.You shouldn't assume that the data is ordered.
{
"table" : {
"columns": [...],
"rows": [
[
"Canada",
2014,
630
],
[
"Canada",
2015,
490
],
[
"Mexico",
2013,
645
],
[
"UK",
2014,
831
],
[
"USA",
2015,
650
],
[
"USA",
2016,
350
]
]
}
}
Puede agregar los datos si selecciona el campo que quiera y después selecciona Suma.You can aggregate the data by selecting the desired field and then selecting sum.
Ejemplo de código para procesar una asignación de vista de datos de tabla.Code sample to process table data view mapping.
"use strict";
import "./../style/visual.less";
import powerbi from "powerbi-visuals-api";
// ...
import DataViewMetadataColumn = powerbi.DataViewMetadataColumn;
import DataViewTable = powerbi.DataViewTable;
import DataViewTableRow = powerbi.DataViewTableRow;
import PrimitiveValue = powerbi.PrimitiveValue;
// other imports
// ...
export class Visual implements IVisual {
private target: HTMLElement;
private host: IVisualHost;
private table: HTMLParagraphElement;
constructor(options: VisualConstructorOptions) {
// constructor body
this.target = options.element;
this.host = options.host;
this.table = document.createElement("table");
this.target.appendChild(this.table);
// ...
}
public update(options: VisualUpdateOptions) {
const dataView: DataView = options.dataViews[0];
const tableDataView: DataViewTable = dataView.table;
if (!tableDataView) {
return
}
while(this.table.firstChild) {
this.table.removeChild(this.table.firstChild);
}
//draw header
const tableHeader = document.createElement("th");
tableDataView.columns.forEach((column: DataViewMetadataColumn) => {
const tableHeaderColumn = document.createElement("td");
tableHeaderColumn.innerText = column.displayName
tableHeader.appendChild(tableHeaderColumn);
});
this.table.appendChild(tableHeader);
//draw rows
tableDataView.rows.forEach((row: DataViewTableRow) => {
const tableRow = document.createElement("tr");
row.forEach((columnValue: PrimitiveValue) => {
const cell = document.createElement("td");
cell.innerText = columnValue.toString();
tableRow.appendChild(cell);
})
this.table.appendChild(tableRow);
});
}
}
El archivo de estilos de objetos visuales style/visual.less
contiene el diseño de la tabla:The visual styles file style/visual.less
contains layout for table:
table {
display: flex;
flex-direction: column;
}
tr, th {
display: flex;
flex: 1;
}
td {
flex: 1;
border: 1px solid black;
}
Asignación de datos de matrizMatrix data mapping
La asignación de datos de matriz es similar a la asignación de datos de tabla, pero las filas se presentan jerárquicamente.Matrix data mapping is similar to table data mapping, but the rows are presented hierarchically. Cualquiera de los valores de los roles de datos se puede usar como un valor de encabezado de columna.Any of the data role values can be used as a column header value.
{
"dataRoles": [
{
"name": "Category",
"displayName": "Category",
"displayNameKey": "Visual_Category",
"kind": "Grouping"
},
{
"name": "Column",
"displayName": "Column",
"displayNameKey": "Visual_Column",
"kind": "Grouping"
},
{
"name": "Measure",
"displayName": "Measure",
"displayNameKey": "Visual_Values",
"kind": "Measure"
}
],
"dataViewMappings": [
{
"matrix": {
"rows": {
"for": {
"in": "Category"
}
},
"columns": {
"for": {
"in": "Column"
}
},
"values": {
"select": [
{
"for": {
"in": "Measure"
}
}
]
}
}
}
]
}
Power BI crea una estructura de datos jerárquica.Power BI creates a hierarchical data structure. La raíz de la jerarquía de árbol incluye los datos de la columna Elementos principales del rol de datos Category
, con elementos secundarios de la columna Elementos secundarios de la tabla de roles de datos.The root of the tree hierarchy includes the data from the Parents column of the Category
data role, with children from the Children column of the data role table.
Conjunto de datos:Dataset:
ParentsParents | ChildrenChildren | Elementos descendientes del secundarioGrandchildren | ColumnasColumns | ValoresValues |
---|---|---|---|---|
Principal1Parent1 | Secundario1Child1 | Subelemento secundario1Grand child1 | Col1Col1 | 55 |
Principal1Parent1 | Secundario1Child1 | Subelemento secundario1Grand child1 | Col2Col2 | 66 |
Principal1Parent1 | Secundario1Child1 | Subelemento secundario2Grand child2 | Col1Col1 | 77 |
Principal1Parent1 | Secundario1Child1 | Subelemento secundario2Grand child2 | Col2Col2 | 88 |
Principal1Parent1 | Secundario2Child2 | Subelemento secundario3Grand child3 | Col1Col1 | 55 |
Principal1Parent1 | Secundario2Child2 | Subelemento secundario3Grand child3 | Col2Col2 | 33 |
Principal1Parent1 | Secundario2Child2 | Subelemento secundario4Grand child4 | Col1Col1 | 44 |
Principal1Parent1 | Secundario2Child2 | Subelemento secundario4Grand child4 | Col2Col2 | 99 |
Principal1Parent1 | Secundario2Child2 | Subelemento secundario5Grand child5 | Col1Col1 | 33 |
Principal1Parent1 | Secundario2Child2 | Subelemento secundario5Grand child5 | Col2Col2 | 55 |
Principal2Parent2 | Secundario3Child3 | Subelemento secundario6Grand child6 | Col1Col1 | 11 |
Principal2Parent2 | Secundario3Child3 | Subelemento secundario6Grand child6 | Col2Col2 | 22 |
Principal2Parent2 | Secundario3Child3 | Subelemento secundario7Grand child7 | Col1Col1 | 77 |
Principal2Parent2 | Secundario3Child3 | Subelemento secundario7Grand child7 | Col2Col2 | 11 |
Principal2Parent2 | Secundario3Child3 | Subelemento secundario8Grand child8 | Col1Col1 | 1010 |
Principal2Parent2 | Secundario3Child3 | Subelemento secundario8Grand child8 | Col2Col2 | 1313 |
El objeto visual de la matriz principal de Power BI representa los datos como una tabla.The core matrix visual of Power BI renders the data as a table.
El objeto visual obtiene su estructura de datos tal y como se describe en el código siguiente (aquí solo se muestran las dos primeras filas de la tabla):The visual gets its data structure as described in the following code (only the first two table rows are shown here):
{
"metadata": {...},
"matrix": {
"rows": {
"levels": [...],
"root": {
"childIdentityFields": [...],
"children": [
{
"level": 0,
"levelValues": [...],
"value": "Parent1",
"identity": {...},
"childIdentityFields": [...],
"children": [
{
"level": 1,
"levelValues": [...],
"value": "Child1",
"identity": {...},
"childIdentityFields": [...],
"children": [
{
"level": 2,
"levelValues": [...],
"value": "Grand child1",
"identity": {...},
"values": {
"0": {
"value": 5 // value for Col1
},
"1": {
"value": 6 // value for Col2
}
}
},
...
]
},
...
]
},
...
]
}
},
"columns": {
"levels": [...],
"root": {
"childIdentityFields": [...],
"children": [
{
"level": 0,
"levelValues": [...],
"value": "Col1",
"identity": {...}
},
{
"level": 0,
"levelValues": [...],
"value": "Col2",
"identity": {...}
},
...
]
}
},
"valueSources": [...]
}
}
Algoritmo de reducción de datosData reduction algorithm
Para controlar la cantidad de datos que se van a recibir en la vista de datos, puede aplicar un algoritmo de reducción de datos.To control the amount of data to receive in the data view, you can apply a data reduction algorithm.
De manera predeterminada, todos los objetos visuales de Power BI tienen aplicado el algoritmo de reducción de datos principal con el valor de count establecido en 1000 puntos de datos.By default, all Power BI visuals have the top data reduction algorithm applied with the count set to 1000 data points. Esto equivale a establecer las siguientes propiedades en el archivo capabilities.json:It's the same as setting the following properties in the capabilities.json file:
"dataReductionAlgorithm": {
"top": {
"count": 1000
}
}
Puede modificar el valor de count por cualquier valor entero hasta 30 000.You can modify the count value to any integer value up to 30000. Los objetos visuales de Power BI basados en R admiten hasta 150 000 filas.R-based Power BI visuals can support up to 150000 rows.
Tipos de algoritmos de reducción de datosData reduction algorithm types
Hay cuatro tipos de valores del algoritmo de reducción de datos:There are four types of data reduction algorithm settings:
top
: si quiere limitar los datos a los valores obtenidos de la parte superior del conjunto de datos.top
: If you want to limit the data to values taken from the top of the dataset. Los primeros valores superiores de count se obtendrán del conjunto de datos.The top first count values will be taken from the dataset.bottom
: si quiere limitar los datos a valores obtenidos de la parte inferior del conjunto de datos.bottom
: If you want to limit the data to values taken from the bottom of the dataset. Los últimos valores de "count" se obtendrán del conjunto de datos.The last "count" values will be taken from the dataset.sample
: reduzca el conjunto de datos mediante un sencillo algoritmo de muestreo limitado a un número de elementos de count.sample
: Reduce the dataset by a simple sampling algorithm, limited to a count number of items. Esto significa que se incluyen el primer y último elemento, y un número de elementos de count que tienen intervalos iguales entre ellos.It means that the first and last items are included, and a count number of items have equal intervals between them. Por ejemplo, si tiene un conjunto de datos [0, 1, 2 … 100] y un valor de count de 9, recibirá los valores [0, 10, 20 ... 100].For example, if you have a dataset [0, 1, 2, ... 100] and a count of 9, you'll receive the values [0, 10, 20 ... 100].window
: carga una ventana de puntos de datos que contiene elementos de count.window
: Loads one window of data points at a time containing count elements. Actualmente,top
ywindow
son equivalentes.Currently,top
andwindow
are equivalent. Estamos trabajando para admitir totalmente una configuración basada en ventanas.We are working toward fully supporting a windowing setting.
Uso de algoritmos de reducción de datosData reduction algorithm usage
El algoritmo de reducción de datos se puede usar en una asignación de vista de datos de matriz, de tabla o categóricos.The data reduction algorithm can be used in categorical, table, or matrix data view mapping.
Puede establecer el algoritmo en categories
o en una sección de grupo de values
para la asignación de datos categóricos.You can set the algorithm into categories
and/or group section of values
for categorical data mapping.
Ejemplo 8Example 8
"dataViewMappings": {
"categorical": {
"categories": {
"for": { "in": "category" },
"dataReductionAlgorithm": {
"window": {
"count": 300
}
}
},
"values": {
"group": {
"by": "series",
"select": [{
"for": {
"in": "measure"
}
}
],
"dataReductionAlgorithm": {
"top": {
"count": 100
}
}
}
}
}
}
Puede aplicar el algoritmo de reducción de datos a la sección rows
de la tabla de asignación de vistas de datos.You can apply the data reduction algorithm to the rows
section of the Data View mapping table.
Ejemplo 9Example 9
"dataViewMappings": [
{
"table": {
"rows": {
"for": {
"in": "values"
},
"dataReductionAlgorithm": {
"top": {
"count": 2000
}
}
}
}
}
]
Puede aplicar el algoritmo de reducción de datos a las secciones rows
y columns
de la matriz de asignación de vistas de datos.You can apply the data reduction algorithm to the rows
and columns
sections of the Data View mapping matrix.
Pasos siguientesNext steps
Lea cómo agregar compatibilidad con la exploración en profundidad para las asignaciones de vistas de datos en los objetos visuales de Power BI.Read how to add Drill-Down support for data view mappings in Power BI visuals.