@sisense/sdk-data 0.16.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dimensional-model/analytics/factory.d.ts +47 -0
- package/dist/dimensional-model/analytics/factory.js +140 -0
- package/dist/dimensional-model/factory.js +1 -1
- package/dist/dimensional-model/filters/factory.d.ts +34 -1
- package/dist/dimensional-model/filters/factory.js +56 -0
- package/dist/dimensional-model/filters/filters.d.ts +4 -0
- package/dist/dimensional-model/filters/filters.js +2 -0
- package/dist/dimensional-model/interfaces.d.ts +15 -2
- package/dist/dimensional-model/measures/factory.d.ts +547 -177
- package/dist/dimensional-model/measures/factory.js +547 -177
- package/dist/index.d.ts +42 -36
- package/dist/index.js +42 -36
- package/dist/translation/resources/en.d.ts +1 -1
- package/dist/translation/resources/en.js +1 -1
- package/dist/translation/resources/index.d.ts +2 -2
- package/dist/translation/resources/uk.js +1 -1
- package/dist/utils.d.ts +16 -0
- package/dist/utils.js +63 -0
- package/package.json +14 -3
|
@@ -7,19 +7,19 @@ import { ForecastFormulaOptions, TrendFormulaOptions } from '../../interfaces.js
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const RankingTypes: {
|
|
9
9
|
/**
|
|
10
|
-
* In competition ranking, items that
|
|
10
|
+
* In competition ranking, items that rank equally receive the same ranking number, and then a gap is left after the equally ranked items in the ranking numbers.
|
|
11
11
|
*/
|
|
12
12
|
StandardCompetition: string;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* In modified competition ranking, items that rank equally receive the same ranking number, and a gap is left before the equally ranked items in the ranking numbers.
|
|
15
15
|
*/
|
|
16
16
|
ModifiedCompetition: string;
|
|
17
17
|
/**
|
|
18
|
-
* In dense ranking, items that
|
|
18
|
+
* In dense ranking, items that rank equally receive the same ranking number, and the next items receive the immediately following ranking number.
|
|
19
19
|
*/
|
|
20
20
|
Dense: string;
|
|
21
21
|
/**
|
|
22
|
-
* In ordinal ranking, all items receive distinct ordinal numbers, including items that
|
|
22
|
+
* In ordinal ranking, all items receive distinct ordinal numbers, including items that rank equally. The assignment of distinct ordinal numbers for equal-ranking items is arbitrary.
|
|
23
23
|
*/
|
|
24
24
|
Ordinal: string;
|
|
25
25
|
};
|
|
@@ -33,465 +33,835 @@ export declare const RankingSortTypes: {
|
|
|
33
33
|
Descending: string;
|
|
34
34
|
};
|
|
35
35
|
/**
|
|
36
|
-
* Creates a calculated measure for a
|
|
36
|
+
* Creates a calculated measure for a valid custom formula built from [base functions](https://docs.sisense.com/main/SisenseLinux/dashboard-functions-reference.htm).
|
|
37
37
|
*
|
|
38
|
-
* Use square brackets within the `formula` to include dimensions or measures.
|
|
38
|
+
* Use square brackets (`[]`) within the `formula` property to include dimensions or measures.
|
|
39
39
|
* Each unique dimension or measure included in the `formula` must be defined using a property:value pair in the `context` parameter.
|
|
40
40
|
*
|
|
41
|
-
* You can nest custom formulas by placing one inside the `formula` parameter of another
|
|
41
|
+
* You can nest custom formulas by placing one inside the `formula` parameter of another.
|
|
42
42
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
43
|
+
* Note: [Shared formulas](https://docs.sisense.com/main/SisenseLinux/shared-formulas.htm) must be
|
|
44
|
+
* fetched prior to use (see {@link @sisense/sdk-ui!useGetSharedFormula | useGetSharedFormula}).
|
|
45
45
|
*
|
|
46
46
|
* @example
|
|
47
|
-
* An example of constructing a
|
|
48
|
-
*
|
|
49
|
-
*
|
|
47
|
+
* An example of constructing a custom formulas using dimensions, measures, and nested custom formulas
|
|
48
|
+
* from the Sample Ecommerce data model.
|
|
49
|
+
* ```ts
|
|
50
|
+
* // Custom formula
|
|
51
|
+
* const profitabilityRatio = measureFactory.customFormula(
|
|
50
52
|
* 'Profitability Ratio',
|
|
51
53
|
* '([totalRevenue] - SUM([cost])) / [totalRevenue]',
|
|
52
54
|
* {
|
|
53
|
-
* totalRevenue:
|
|
55
|
+
* totalRevenue: measureFactory.sum(DM.Commerce.Revenue),
|
|
54
56
|
* cost: DM.Commerce.Cost,
|
|
55
57
|
* },
|
|
56
58
|
* );
|
|
57
59
|
*
|
|
58
|
-
*
|
|
60
|
+
* // Nested custom formula
|
|
61
|
+
* const profitabilityRatioRank = measureFactory.customFormula(
|
|
59
62
|
* 'Profitability Ratio Rank',
|
|
60
63
|
* 'RANK([profRatio], "ASC", "1224")',
|
|
61
64
|
* {
|
|
62
65
|
* profRatio: profitabilityRatio,
|
|
63
66
|
* },
|
|
64
67
|
* );
|
|
65
|
-
*
|
|
66
|
-
* return (
|
|
67
|
-
* <Chart
|
|
68
|
-
* dataSet={DM.DataSource}
|
|
69
|
-
* chartType="line"
|
|
70
|
-
* dataOptions={{
|
|
71
|
-
* category: [DM.Commerce.AgeRange],
|
|
72
|
-
* value: [
|
|
73
|
-
* profitabilityRatioRank,
|
|
74
|
-
* {
|
|
75
|
-
* column: measures.sum(DM.Commerce.Revenue, 'Total Revenue'),
|
|
76
|
-
* showOnRightAxis: true,
|
|
77
|
-
* chartType: 'column',
|
|
78
|
-
* },
|
|
79
|
-
* {
|
|
80
|
-
* column: measures.sum(DM.Commerce.Cost, 'Total Cost'),
|
|
81
|
-
* showOnRightAxis: true,
|
|
82
|
-
* chartType: 'column',
|
|
83
|
-
* },
|
|
84
|
-
* ],
|
|
85
|
-
* }}
|
|
86
|
-
* />
|
|
87
|
-
* );
|
|
88
68
|
* ```
|
|
89
69
|
* @param title - Title of the measure to be displayed in legend
|
|
90
70
|
* @param formula - Formula to be used for the measure
|
|
91
71
|
* @param context - Formula context as a map of strings to measures or attributes
|
|
92
|
-
* @returns A calculated measure
|
|
72
|
+
* @returns A calculated measure instance
|
|
93
73
|
*/
|
|
94
74
|
export declare function customFormula(title: string, formula: string, context: CustomFormulaContext): Attribute | Measure;
|
|
95
75
|
/**
|
|
96
|
-
* Creates
|
|
97
|
-
*
|
|
76
|
+
* Creates an aggregated measure.
|
|
77
|
+
*
|
|
78
|
+
* This is a base function to build other aggregation functions (e.g., `sum`, `average`, etc.)
|
|
98
79
|
* as listed in {@link AggregationTypes}.
|
|
99
80
|
*
|
|
81
|
+
* @example
|
|
82
|
+
* Calculate the total cost across all items in a category from the Sample Ecommerce data model.
|
|
83
|
+
* ```ts
|
|
84
|
+
* measureFactory.aggregate(DM.Commerce.Cost, 'sum'),
|
|
85
|
+
* ```
|
|
100
86
|
* @param attribute - Attribute to aggregate
|
|
101
87
|
* @param aggregationType - Aggregation type. See {@link AggregationTypes}
|
|
102
88
|
* @param name - Optional name for the new measure
|
|
103
|
-
* @param format -
|
|
104
|
-
* @returns A
|
|
89
|
+
* @param format - Optional numeric formatting to apply using a Numeral.js format string. Can only be used for explicit queries. Cannot be used in charts, tables, etc.
|
|
90
|
+
* @returns A measure instance
|
|
105
91
|
*/
|
|
106
92
|
export declare function aggregate(attribute: Attribute, aggregationType: string, name?: string, format?: string): BaseMeasure;
|
|
107
93
|
/**
|
|
108
|
-
*
|
|
94
|
+
* Creates a calculated measure from a numeric value.
|
|
109
95
|
*
|
|
96
|
+
* @example
|
|
97
|
+
* Creates a calculated measure from a numeric value.
|
|
98
|
+
* ```ts
|
|
99
|
+
* measureFactory.constant(42)
|
|
100
|
+
* ```
|
|
110
101
|
* @param value - Value to be returned as a measure
|
|
111
|
-
* @returns A
|
|
102
|
+
* @returns A calculated measure instance
|
|
112
103
|
*/
|
|
113
104
|
export declare function constant(value: number): CalculatedMeasure;
|
|
114
105
|
/**
|
|
115
|
-
* Creates a sum aggregation over the given attribute.
|
|
106
|
+
* Creates a sum aggregation measure over the given attribute.
|
|
107
|
+
*
|
|
108
|
+
* To create a running sum, use {@link runningSum}.
|
|
116
109
|
*
|
|
110
|
+
* @example
|
|
111
|
+
* Calculate the total cost across all items in a category from the Sample Ecommerce data model.
|
|
112
|
+
* ```ts
|
|
113
|
+
* measureFactory.sum(DM.Commerce.Cost)
|
|
114
|
+
* ```
|
|
117
115
|
* @param attribute - Attribute to aggregate
|
|
118
116
|
* @param name - Optional name for the new measure
|
|
119
|
-
* @param format - Optional numeric formatting to apply
|
|
120
|
-
* @returns A
|
|
117
|
+
* @param format - Optional numeric formatting to apply using a Numeral.js format string. Can only be used for explicit queries. Cannot be used in charts, tables, etc.
|
|
118
|
+
* @returns A measure instance
|
|
121
119
|
*/
|
|
122
120
|
export declare function sum(attribute: Attribute, name?: string, format?: string): BaseMeasure;
|
|
123
121
|
/**
|
|
124
|
-
* Creates an average aggregation over the given attribute.
|
|
122
|
+
* Creates an average aggregation measure over the given attribute.
|
|
125
123
|
*
|
|
124
|
+
* @example
|
|
125
|
+
* Calculate the average cost across all items in a category from the Sample Ecommerce data model.
|
|
126
|
+
* ```ts
|
|
127
|
+
* measureFactory.average(DM.Commerce.Cost)
|
|
128
|
+
* ```
|
|
126
129
|
* @param attribute - Attribute to aggregate
|
|
127
130
|
* @param name - Optional name for the new measure
|
|
128
|
-
* @param format - Optional numeric formatting to apply
|
|
129
|
-
* @returns A
|
|
131
|
+
* @param format - Optional numeric formatting to apply using a Numeral.js format string. Can only be used for explicit queries. Cannot be used in charts, tables, etc.
|
|
132
|
+
* @returns A measure instance
|
|
130
133
|
*/
|
|
131
134
|
export declare function average(attribute: Attribute, name?: string, format?: string): BaseMeasure;
|
|
132
135
|
/**
|
|
133
|
-
* Creates a min aggregation over the given attribute.
|
|
136
|
+
* Creates a min aggregation measure over the given attribute.
|
|
134
137
|
*
|
|
138
|
+
* @example
|
|
139
|
+
* Calculate the minimum cost across all items in a category from the Sample Ecommerce data model.
|
|
140
|
+
* ```ts
|
|
141
|
+
* measureFactory.min(DM.Commerce.Cost)
|
|
142
|
+
* ```
|
|
135
143
|
* @param attribute - Attribute to aggregate
|
|
136
144
|
* @param name - Optional name for the new measure
|
|
137
|
-
* @param format - Optional numeric formatting to apply
|
|
138
|
-
* @returns A
|
|
145
|
+
* @param format - Optional numeric formatting to apply using a Numeral.js format string. Can only be used for explicit queries. Cannot be used in charts, tables, etc.
|
|
146
|
+
* @returns A measure instance
|
|
139
147
|
*/
|
|
140
148
|
export declare function min(attribute: Attribute, name?: string, format?: string): BaseMeasure;
|
|
141
149
|
/**
|
|
142
|
-
* Creates a max aggregation over the given attribute.
|
|
150
|
+
* Creates a max aggregation measure over the given attribute.
|
|
143
151
|
*
|
|
152
|
+
* @example
|
|
153
|
+
* Calculate the maximum cost across all items in a category from the Sample Ecommerce data model.
|
|
154
|
+
* ```ts
|
|
155
|
+
* measureFactory.max(DM.Commerce.Cost)
|
|
156
|
+
* ```
|
|
144
157
|
* @param attribute - Attribute to aggregate
|
|
145
158
|
* @param name - Optional name for the new measure
|
|
146
|
-
* @param format - Optional numeric formatting to apply
|
|
147
|
-
* @returns A
|
|
159
|
+
* @param format - Optional numeric formatting to apply using a Numeral.js format string. Can only be used for explicit queries. Cannot be used in charts, tables, etc.
|
|
160
|
+
* @returns A measure instance
|
|
148
161
|
*/
|
|
149
162
|
export declare function max(attribute: Attribute, name?: string, format?: string): BaseMeasure;
|
|
150
163
|
/**
|
|
151
|
-
* Creates a median aggregation over the given attribute.
|
|
164
|
+
* Creates a median aggregation measure over the given attribute.
|
|
152
165
|
*
|
|
166
|
+
* @example
|
|
167
|
+
* Calculate the median cost across all items in a category from the Sample Ecommerce data model.
|
|
168
|
+
* ```ts
|
|
169
|
+
* measureFactory.median(DM.Commerce.Cost)
|
|
170
|
+
* ```
|
|
153
171
|
* @param attribute - Attribute to aggregate
|
|
154
172
|
* @param name - Optional name for the new measure
|
|
155
|
-
* @param format - Optional numeric formatting to apply
|
|
156
|
-
* @returns A
|
|
173
|
+
* @param format - Optional numeric formatting to apply using a Numeral.js format string. Can only be used for explicit queries. Cannot be used in charts, tables, etc.
|
|
174
|
+
* @returns A measure instance
|
|
157
175
|
*/
|
|
158
176
|
export declare function median(attribute: Attribute, name?: string, format?: string): BaseMeasure;
|
|
159
177
|
/**
|
|
160
|
-
* Creates a count aggregation over the given attribute.
|
|
178
|
+
* Creates a count aggregation measure over the given attribute.
|
|
179
|
+
*
|
|
180
|
+
* To count distinct values in the given attribute, use {@link countDistinct}.
|
|
161
181
|
*
|
|
182
|
+
* @example
|
|
183
|
+
* Counts the number of Commerce items from the Sample Ecommerce data model.
|
|
184
|
+
* ```ts
|
|
185
|
+
* measureFactory.count(DM.Commerce.BrandID)
|
|
186
|
+
* ```
|
|
162
187
|
* @param attribute - Attribute to aggregate
|
|
163
188
|
* @param name - Optional name for the new measure
|
|
164
|
-
* @param format - Optional numeric formatting to apply
|
|
165
|
-
* @returns A
|
|
189
|
+
* @param format - Optional numeric formatting to apply using a Numeral.js format string. Can only be used for explicit queries. Cannot be used in charts, tables, etc.
|
|
190
|
+
* @returns A measure instance
|
|
166
191
|
*/
|
|
167
192
|
export declare function count(attribute: Attribute, name?: string, format?: string): BaseMeasure;
|
|
168
193
|
/**
|
|
169
|
-
* Creates a count distinct aggregation over the given attribute.
|
|
194
|
+
* Creates a count distinct aggregation measure over the given attribute.
|
|
170
195
|
*
|
|
196
|
+
* To count all values in the given attribute, use {@link count}.
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* Calculate the number of distinct brands from the Sample Ecommerce data model.
|
|
200
|
+
* ```ts
|
|
201
|
+
* measureFactory.countDistinct(DM.Brand.BrandID)
|
|
202
|
+
* ```
|
|
171
203
|
* @param attribute - Attribute to aggregate
|
|
172
204
|
* @param name - Optional name for the new measure
|
|
173
|
-
* @param format - Optional numeric formatting to apply
|
|
174
|
-
* @returns A
|
|
205
|
+
* @param format - Optional numeric formatting to apply using a Numeral.js format string. Can only be used for explicit queries. Cannot be used in charts, tables, etc.
|
|
206
|
+
* @returns A measure instance
|
|
175
207
|
*/
|
|
176
208
|
export declare function countDistinct(attribute: Attribute, name?: string, format?: string): BaseMeasure;
|
|
177
209
|
/**
|
|
178
210
|
* Creates a measured value with the given measure and set of filters.
|
|
179
211
|
*
|
|
212
|
+
* A measured value only includes values from items that match the provided filters.
|
|
213
|
+
*
|
|
214
|
+
* For example you can use a measured value to get a total cost for all items where the cost is greater than 100.
|
|
215
|
+
*
|
|
216
|
+
* Note that the filters on the measured value override the filters on the query, chart, or table the
|
|
217
|
+
* measured value is used in.
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* Calculate the total cost across all items in a category from the Sample Ecommerce data model,
|
|
221
|
+
* where the cost is greater than 100. Additional filtering on the cost will not affect this measure.
|
|
222
|
+
* ```ts
|
|
223
|
+
* measureFactory.measuredValue(
|
|
224
|
+
* measureFactory.sum(DM.Commerce.Cost),
|
|
225
|
+
* [filters.greaterThan(DM.Commerce.Cost, 100)],
|
|
226
|
+
* 'Cost Greater Than 100'
|
|
227
|
+
* ),
|
|
228
|
+
* ```
|
|
180
229
|
* @param measure - Measure to filter
|
|
181
230
|
* @param filters - Filters to apply to the measure
|
|
182
231
|
* @param name - Optional name for the new measure
|
|
183
|
-
* @param format - Optional numeric formatting to apply
|
|
184
|
-
* @returns A
|
|
232
|
+
* @param format - Optional numeric formatting to apply using a Numeral.js format string. Can only be used for explicit queries. Cannot be used in charts, tables, etc.
|
|
233
|
+
* @returns A calculated measure instance
|
|
185
234
|
*/
|
|
186
235
|
export declare function measuredValue(measure: Measure, filters: Filter[], name?: string, format?: string): CalculatedMeasure;
|
|
187
236
|
/**
|
|
188
|
-
*
|
|
237
|
+
* Creates a calculated measure by adding two given numbers or measures.
|
|
189
238
|
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```ts
|
|
241
|
+
* const measure1 = measureFactory.sum(DM.Dimension.Attribute1);
|
|
242
|
+
* const measure2 = measureFactory.sum(DM.Dimension.Attribute2);
|
|
243
|
+
* const measureSum = measureFactory.add(measure1, measure2);
|
|
244
|
+
* ```
|
|
190
245
|
* @param value1 - First value
|
|
191
246
|
* @param value2 - Second value
|
|
192
247
|
* @param name - Optional name for the new measure
|
|
193
248
|
* @param withParentheses - Optional boolean flag whether to wrap the arithmetic operation with parentheses
|
|
194
|
-
* @returns A
|
|
249
|
+
* @returns A calculated measure instance
|
|
195
250
|
*/
|
|
196
251
|
export declare function add(value1: Measure | number, value2: Measure | number, name?: string, withParentheses?: boolean): CalculatedMeasure;
|
|
197
252
|
/**
|
|
198
|
-
*
|
|
253
|
+
* Creates a calculated measure by subtracting two given numbers or measures. Subtracts `value2` from `value1`.
|
|
199
254
|
*
|
|
255
|
+
* @example
|
|
256
|
+
* ```ts
|
|
257
|
+
* const measure1 = measureFactory.sum(DM.Dimension.Attribute1);
|
|
258
|
+
* const measure2 = measureFactory.sum(DM.Dimension.Attribute2);
|
|
259
|
+
* const measureDifference = measureFactory.subtract(measure1, measure2);
|
|
260
|
+
* ```
|
|
200
261
|
* @param value1 - First value
|
|
201
262
|
* @param value2 - Second value
|
|
202
263
|
* @param name - Optional name for the new measure
|
|
203
264
|
* @param withParentheses - Optional boolean flag whether to wrap the arithmetic operation with parentheses
|
|
204
|
-
* @returns A
|
|
265
|
+
* @returns A calculated measure instance
|
|
205
266
|
*/
|
|
206
267
|
export declare function subtract(value1: Measure | number, value2: Measure | number, name?: string, withParentheses?: boolean): CalculatedMeasure;
|
|
207
268
|
/**
|
|
208
|
-
*
|
|
269
|
+
* Creates a calculated measure by multiplying two given numbers or measures.
|
|
209
270
|
*
|
|
271
|
+
* @example
|
|
272
|
+
* ```ts
|
|
273
|
+
* const measure1 = measureFactory.sum(DM.Dimension.Attribute1);
|
|
274
|
+
* const measure2 = measureFactory.sum(DM.Dimension.Attribute2);
|
|
275
|
+
* const measureProduct = measureFactory.multiply(measure1, measure2);
|
|
276
|
+
* ```
|
|
210
277
|
* @param value1 - First value
|
|
211
278
|
* @param value2 - Second value
|
|
212
279
|
* @param name - Optional name for the new measure
|
|
213
280
|
* @param withParentheses - Optional boolean flag whether to wrap the arithmetic operation with parentheses
|
|
214
|
-
* @returns A
|
|
281
|
+
* @returns A calculated measure instance
|
|
215
282
|
*/
|
|
216
283
|
export declare function multiply(value1: Measure | number, value2: Measure | number, name?: string, withParentheses?: boolean): CalculatedMeasure;
|
|
217
284
|
/**
|
|
218
|
-
*
|
|
285
|
+
* Creates a calculated measure by dividing two given numbers or measures. Divides `value1` by `value2`.
|
|
219
286
|
*
|
|
287
|
+
* @example
|
|
288
|
+
* ```ts
|
|
289
|
+
* const measure1 = measureFactory.sum(DM.Dimension.Attribute1);
|
|
290
|
+
* const measure2 = measureFactory.sum(DM.Dimension.Attribute2);
|
|
291
|
+
* const measureQuotient = measureFactory.divide(measure1, measure2);
|
|
292
|
+
* ```
|
|
220
293
|
* @param value1 - First value
|
|
221
294
|
* @param value2 - Second value
|
|
222
295
|
* @param name - Optional name for the new measure
|
|
223
296
|
* @param withParentheses - Optional boolean flag whether to wrap the arithmetic operation with parentheses
|
|
224
|
-
* @returns A
|
|
297
|
+
* @returns A calculated measure instance
|
|
225
298
|
*/
|
|
226
299
|
export declare function divide(value1: Measure | number, value2: Measure | number, name?: string, withParentheses?: boolean): CalculatedMeasure;
|
|
227
300
|
/**
|
|
228
|
-
*
|
|
301
|
+
* Creates a calculated measure that calculates the running total starting from the beginning
|
|
302
|
+
* of the year up to the current day, week, month, or quarter.
|
|
303
|
+
*
|
|
304
|
+
* The time resolution is determined by the minimum date level of the date dimension in the query
|
|
305
|
+
* that uses the returned measure.
|
|
229
306
|
*
|
|
307
|
+
* @example
|
|
308
|
+
* Calculate the running total of total cost from the Sample Ecommerce data model, starting from the
|
|
309
|
+
* beginning of the year up to the current day, week, month, or quarter.
|
|
310
|
+
* ```ts
|
|
311
|
+
* measureFactory.yearToDateSum(measureFactory.sum(DM.Commerce.Cost))
|
|
312
|
+
* ```
|
|
230
313
|
* @param measure - Measure to apply the YTD Sum to
|
|
231
314
|
* @param name - Name for the new measure
|
|
232
|
-
* @returns A
|
|
315
|
+
* @returns A calculated measure instance
|
|
233
316
|
*/
|
|
234
317
|
export declare function yearToDateSum(measure: Measure, name?: string): CalculatedMeasure;
|
|
235
318
|
/**
|
|
236
|
-
*
|
|
237
|
-
*
|
|
319
|
+
* Creates a calculated measure that calculates the running total starting from the beginning
|
|
320
|
+
* of the quarter up to the current day, week, or month.
|
|
238
321
|
*
|
|
322
|
+
* The time resolution is determined by the minimum date level of the date dimension in the query
|
|
323
|
+
* that uses the returned measure.
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* Calculate the running total of total cost from the Sample Ecommerce data model, starting from the
|
|
327
|
+
* beginning of the quarter up to the current day, week, or month.
|
|
328
|
+
* ```ts
|
|
329
|
+
* measureFactory.quarterToDateSum(measureFactory.sum(DM.Commerce.Cost))
|
|
330
|
+
* ```
|
|
239
331
|
* @param measure - Measure to apply the QTD Sum to
|
|
240
332
|
* @param name - Name for the new measure
|
|
241
|
-
* @returns A
|
|
333
|
+
* @returns A calculated measure instance
|
|
242
334
|
*/
|
|
243
335
|
export declare function quarterToDateSum(measure: Measure, name?: string): CalculatedMeasure;
|
|
244
336
|
/**
|
|
245
|
-
*
|
|
246
|
-
*
|
|
337
|
+
* Creates a calculated measure that calculates the running total starting from the beginning
|
|
338
|
+
* of the month up to the current day or week.
|
|
339
|
+
*
|
|
340
|
+
* The time resolution is determined by the minimum date level of the date dimension in the query
|
|
341
|
+
* that uses the returned measure.
|
|
247
342
|
*
|
|
343
|
+
* @example
|
|
344
|
+
* Calculate the running total of total cost from the Sample Ecommerce data model, starting from the
|
|
345
|
+
* beginning of the month up to the current day or week.
|
|
346
|
+
* ```ts
|
|
347
|
+
* measureFactory.monthToDateSum(measureFactory.sum(DM.Commerce.Cost))
|
|
348
|
+
* ```
|
|
248
349
|
* @param measure - Measure to apply the MTD Sum to
|
|
249
350
|
* @param name - Name for the new measure
|
|
250
|
-
* @returns A
|
|
351
|
+
* @returns A calculated measure instance
|
|
251
352
|
*/
|
|
252
353
|
export declare function monthToDateSum(measure: Measure, name?: string): CalculatedMeasure;
|
|
253
354
|
/**
|
|
254
|
-
*
|
|
255
|
-
*
|
|
355
|
+
* Creates a calculated measure that calculates the running total starting from the beginning
|
|
356
|
+
* of the week up to the current day.
|
|
256
357
|
*
|
|
358
|
+
* The time resolution is determined by the minimum date level of the date dimension in the query
|
|
359
|
+
* that uses the returned measure.
|
|
360
|
+
*
|
|
361
|
+
* @example
|
|
362
|
+
* Calculate the running total of total cost from the Sample Ecommerce data model, starting from the
|
|
363
|
+
* beginning of the week up to the current day.
|
|
364
|
+
* ```ts
|
|
365
|
+
* measureFactory.weekToDateSum(measureFactory.sum(DM.Commerce.Cost))
|
|
366
|
+
* ```
|
|
257
367
|
* @param measure - Measure to apply the WTD Sum to
|
|
258
368
|
* @param name - Name for the new measure
|
|
259
|
-
* @returns A
|
|
369
|
+
* @returns A calculated measure instance
|
|
260
370
|
*/
|
|
261
371
|
export declare function weekToDateSum(measure: Measure, name?: string): CalculatedMeasure;
|
|
262
372
|
/**
|
|
263
|
-
*
|
|
264
|
-
* according to the current sorting order in the query.
|
|
373
|
+
* Creates a calculated measure that calculates the running total of a given measure.
|
|
265
374
|
*
|
|
266
|
-
*
|
|
267
|
-
* To accumulate by another order, the relevant measure should be added as an additional column and sorted.
|
|
375
|
+
* The running sum is calculated using the current sort order of the query it's used in.
|
|
268
376
|
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
377
|
+
* @example
|
|
378
|
+
* Calculate the running sum of the total cost from the Sample Ecommerce data model across all categories.
|
|
379
|
+
* ```ts
|
|
380
|
+
* measureFactory.runningSum(measureFactory.sum(DM.Commerce.Cost)),
|
|
381
|
+
* ```
|
|
271
382
|
*
|
|
272
|
-
*
|
|
383
|
+
* Running sum values from the Sample Ecommerce data model when categorizing by age range.
|
|
384
|
+
* | AgeRange | Cost | Running Cost |
|
|
385
|
+
* | --- | --- | --- |
|
|
386
|
+
* | 0-18 | 4.32M | 4.32M |
|
|
387
|
+
* | 19-24 | 8.66M | 12.98M |
|
|
388
|
+
* | 25-34 | 21.19M | 34.16M |
|
|
389
|
+
* | 35-44 | 23.64M | 57.8M |
|
|
390
|
+
* | 45-54 | 20.39M | 78.19M |
|
|
391
|
+
* | 55-64 | 11.82M | 90.01M |
|
|
392
|
+
* | 65+ | 17.26M | 107.27M |
|
|
393
|
+
* @param measure - Measure to apply the running sum to
|
|
273
394
|
* @param _continuous - Boolean flag whether to accumulate the sum continuously
|
|
274
|
-
* when there are two or more dimensions. The default value is
|
|
395
|
+
* when there are two or more dimensions. The default value is false.
|
|
275
396
|
* @param name - Name for the new measure
|
|
276
|
-
* @returns A
|
|
397
|
+
* @returns A calculated measure instance
|
|
277
398
|
*/
|
|
278
399
|
export declare function runningSum(measure: Measure, _continuous?: boolean, name?: string): CalculatedMeasure;
|
|
279
400
|
/**
|
|
280
|
-
*
|
|
401
|
+
* Creates a calculated measure that calculates growth over a period of time.
|
|
281
402
|
*
|
|
282
|
-
*
|
|
403
|
+
* The time resolution is determined by the minimum date level of the date dimension in the query
|
|
404
|
+
* that uses the returned measure.
|
|
283
405
|
*
|
|
284
|
-
*
|
|
406
|
+
* Growth is calculated using the following formula: `(currentPeriod – previousPeriod) / previousPeriod`.
|
|
285
407
|
*
|
|
286
|
-
*
|
|
408
|
+
* For example, if this period the value is 12 and the previous period's value was 10, the growth for
|
|
409
|
+
* this period is 20%, returned as '0.2' (calculation: `(12 – 10) / 10 = 0.2`).
|
|
287
410
|
*
|
|
288
|
-
*
|
|
411
|
+
* If the previous period's value is greater than the current period, the growth will be negative.
|
|
289
412
|
*
|
|
290
|
-
*
|
|
413
|
+
* For example, if this period the value is 80, and the previous period's was 100, the growth for
|
|
414
|
+
* this period is -20%, returned as `-0.2` (calculation: `(80 – 100) / 100 = -0.2`).
|
|
291
415
|
*
|
|
292
|
-
*
|
|
416
|
+
* @example
|
|
417
|
+
* Calculate the growth in total cost this period in comparison to the previous period from the
|
|
418
|
+
* Sample Ecommerce data model.
|
|
419
|
+
* ```ts
|
|
420
|
+
* measureFactory.growth(measureFactory.sum(DM.Commerce.Cost))
|
|
421
|
+
* ```
|
|
293
422
|
* @param measure - Measure to apply growth to
|
|
294
423
|
* @param name - Name for the new measure
|
|
295
|
-
* @returns A
|
|
424
|
+
* @returns A calculated measure instance
|
|
296
425
|
*/
|
|
297
426
|
export declare function growth(measure: Measure, name?: string): CalculatedMeasure;
|
|
298
427
|
/**
|
|
299
|
-
*
|
|
428
|
+
* Creates a calculated measure that calculates growth rate over a period of time.
|
|
300
429
|
*
|
|
301
|
-
*
|
|
302
|
-
*
|
|
430
|
+
* The time resolution is determined by the minimum date level of the date dimension in the query
|
|
431
|
+
* that uses the returned measure.
|
|
303
432
|
*
|
|
304
|
-
*
|
|
433
|
+
* Growth rate is calculated using the following formula: `currentPeriod / previousPeriod`.
|
|
305
434
|
*
|
|
306
|
-
*
|
|
435
|
+
* For example, if this period the value is 12 and the previous period's value was 10, the growth rate for
|
|
436
|
+
* this period is 120%, returned as '1.2' (calculation: `12 / 10 = 1.2`).
|
|
307
437
|
*
|
|
308
|
-
*
|
|
438
|
+
* If the previous period's value is greater than the current period, the growth rate will be less than one.
|
|
439
|
+
*
|
|
440
|
+
* For example, if this period the value is 80, and the previous period's was 100, the growth for
|
|
441
|
+
* this period is 80%, returned as `0.8` (calculation: `80 / 100 = .8`).
|
|
442
|
+
*
|
|
443
|
+
* @example
|
|
444
|
+
* Calculate the growth rate in total cost this period in comparison to the previous period from the
|
|
445
|
+
* Sample Ecommerce data model.
|
|
446
|
+
* ```ts
|
|
447
|
+
* measureFactory.growthRate(measureFactory.sum(DM.Commerce.Cost))
|
|
448
|
+
* ```
|
|
309
449
|
* @param measure - Measure to apply the Growth rate
|
|
310
450
|
* @param name - Name for the new measure
|
|
311
|
-
* @returns A
|
|
451
|
+
* @returns A calculated measure instance
|
|
312
452
|
*/
|
|
313
453
|
export declare function growthRate(measure: Measure, name?: string): CalculatedMeasure;
|
|
314
454
|
/**
|
|
315
|
-
*
|
|
316
|
-
* Date dimension will be dynamically taken from the query.
|
|
455
|
+
* Creates a calculated measure that calculates the growth from the previous week to the current week.
|
|
317
456
|
*
|
|
457
|
+
* The date dimension will be dynamically taken from the query that uses the returned measure.
|
|
458
|
+
*
|
|
459
|
+
* Growth is calculated using the following formula: `(currentWeek – previousWeek) / previousWeek`.
|
|
460
|
+
*
|
|
461
|
+
* For example, if this week the value is 12 and the previous week's value was 10, the growth for
|
|
462
|
+
* this week is 20%, returned as '0.2' (calculation: `(12 – 10) / 10 = 0.2`).
|
|
463
|
+
*
|
|
464
|
+
* If the previous week's value is greater than the current week, the growth will be negative.
|
|
465
|
+
*
|
|
466
|
+
* For example, if this week the value is 80, and the previous week's was 100, the growth for
|
|
467
|
+
* this week is -20%, returned as `-0.2` (calculation: `(80 – 100) / 100 = -0.2`).
|
|
468
|
+
*
|
|
469
|
+
* @example
|
|
470
|
+
* Calculate the growth in total cost this week in comparison to the previous week from the Sample
|
|
471
|
+
* Ecommerce data model.
|
|
472
|
+
* ```ts
|
|
473
|
+
* measureFactory.growthPastWeek(measureFactory.sum(DM.Commerce.Cost))
|
|
474
|
+
* ```
|
|
318
475
|
* @param measure - Measure to apply growth to
|
|
319
476
|
* @param name - Name for the new measure
|
|
320
|
-
* @returns A
|
|
477
|
+
* @returns A calculated measure instance
|
|
321
478
|
*/
|
|
322
479
|
export declare function growthPastWeek(measure: Measure, name?: string): CalculatedMeasure;
|
|
323
480
|
/**
|
|
324
|
-
*
|
|
325
|
-
*
|
|
481
|
+
* Creates a calculated measure that calculates the growth from the previous month to the current month.
|
|
482
|
+
*
|
|
483
|
+
* The date dimension will be dynamically taken from the query that uses the returned measure.
|
|
326
484
|
*
|
|
485
|
+
* Growth is calculated using the following formula: `(currentMonth – previousMonth) / previousMonth`.
|
|
486
|
+
*
|
|
487
|
+
* For example, if this month the value is 12 and the previous month's value was 10, the growth for
|
|
488
|
+
* this month is 20%, returned as '0.2' (calculation: `(12 – 10) / 10 = 0.2`).
|
|
489
|
+
*
|
|
490
|
+
* If the previous month's value is greater than the current month, the growth will be negative.
|
|
491
|
+
*
|
|
492
|
+
* For example, if this month the value is 80, and the previous month's was 100, the growth for
|
|
493
|
+
* this month is -20%, returned as `-0.2` (calculation: `(80 – 100) / 100 = -0.2`).
|
|
494
|
+
*
|
|
495
|
+
* @example
|
|
496
|
+
* Calculate the growth in total cost this month in comparison to the previous month from the Sample
|
|
497
|
+
* Ecommerce data model.
|
|
498
|
+
* ```ts
|
|
499
|
+
* measureFactory.growthPastMonth(measureFactory.sum(DM.Commerce.Cost))
|
|
500
|
+
* ```
|
|
327
501
|
* @param measure - Measure to apply growth to
|
|
328
502
|
* @param name - Name for the new measure
|
|
329
|
-
* @returns A
|
|
503
|
+
* @returns A calculated measure instance
|
|
330
504
|
*/
|
|
331
505
|
export declare function growthPastMonth(measure: Measure, name?: string): CalculatedMeasure;
|
|
332
506
|
/**
|
|
333
|
-
*
|
|
334
|
-
*
|
|
507
|
+
* Creates a calculated measure that calculates the growth from the previous quarter to the current quarter.
|
|
508
|
+
*
|
|
509
|
+
* The date dimension will be dynamically taken from the query that uses the returned measure.
|
|
510
|
+
*
|
|
511
|
+
* Growth is calculated using the following formula: `(currentQuarter – previousQuarter) / previousQuarter`.
|
|
512
|
+
*
|
|
513
|
+
* For example, if this quarter the value is 12 and the previous quarter's value was 10, the growth for
|
|
514
|
+
* this quarter is 20%, returned as '0.2' (calculation: `(12 – 10) / 10 = 0.2`).
|
|
335
515
|
*
|
|
516
|
+
* If the previous quarter's value is greater than the current quarter, the growth will be negative.
|
|
517
|
+
*
|
|
518
|
+
* For example, if this quarter the value is 80, and the previous quarter's was 100, the growth for
|
|
519
|
+
* this quarter is -20%, returned as `-0.2` (calculation: `(80 – 100) / 100 = -0.2`).
|
|
520
|
+
*
|
|
521
|
+
* @example
|
|
522
|
+
* Calculate the growth in total cost this quarter in comparison to the previous quarter from the
|
|
523
|
+
* Sample Ecommerce data model.
|
|
524
|
+
* ```ts
|
|
525
|
+
* measureFactory.growthPastQuarter(measureFactory.sum(DM.Commerce.Cost))
|
|
526
|
+
* ```
|
|
336
527
|
* @param measure - Measure to apply growth to
|
|
337
528
|
* @param name - Name for the new measure
|
|
338
|
-
* @returns A
|
|
529
|
+
* @returns A calculated measure instance
|
|
339
530
|
*/
|
|
340
531
|
export declare function growthPastQuarter(measure: Measure, name?: string): CalculatedMeasure;
|
|
341
532
|
/**
|
|
342
|
-
*
|
|
343
|
-
*
|
|
533
|
+
* Creates a calculated measure that calculates the growth from the previous year to the current year.
|
|
534
|
+
*
|
|
535
|
+
* The date dimension will be dynamically taken from the query that uses the returned measure.
|
|
536
|
+
*
|
|
537
|
+
* Growth is calculated using the following formula: `(currentYear – previousYear) / previousYear`.
|
|
538
|
+
*
|
|
539
|
+
* For example, if this year the value is 12 and the previous year's value was 10, the growth for
|
|
540
|
+
* this year is 20%, returned as '0.2' (calculation: `(12 – 10) / 10 = 0.2`).
|
|
541
|
+
*
|
|
542
|
+
* If the previous year's value is greater than the current year, the growth will be negative.
|
|
344
543
|
*
|
|
544
|
+
* For example, if this year the value is 80, and the previous year's was 100, the growth for
|
|
545
|
+
* this year is -20%, returned as `-0.2` (calculation: `(80 – 100) / 100 = -0.2`).
|
|
546
|
+
*
|
|
547
|
+
* @example
|
|
548
|
+
* Calculate the growth in total cost this year in comparison to the previous year from the Sample
|
|
549
|
+
* Ecommerce data model.
|
|
550
|
+
* ```ts
|
|
551
|
+
* measureFactory.growthPastYear(measureFactory.sum(DM.Commerce.Cost))
|
|
552
|
+
* ```
|
|
345
553
|
* @param measure - Measure to apply growth to
|
|
346
554
|
* @param name - Name for the new measure
|
|
347
|
-
* @returns A
|
|
555
|
+
* @returns A calculated measure instance
|
|
348
556
|
*/
|
|
349
557
|
export declare function growthPastYear(measure: Measure, name?: string): CalculatedMeasure;
|
|
350
558
|
/**
|
|
351
|
-
*
|
|
352
|
-
*
|
|
559
|
+
* Creates a calculated measure that calculates the difference between this period's data
|
|
560
|
+
* and the data from the previous period for the given measure.
|
|
353
561
|
*
|
|
354
|
-
*
|
|
562
|
+
* The time resolution is determined by the minimum date level of the date dimension in the query
|
|
563
|
+
* that uses the returned measure.
|
|
564
|
+
*
|
|
565
|
+
* @example
|
|
566
|
+
* Calculate the difference between this period's total cost and the previous period's total cost
|
|
567
|
+
* from the Sample Ecommerce data model.
|
|
568
|
+
* ```ts
|
|
569
|
+
* measureFactory.difference(measureFactory.sum(DM.Commerce.Cost))
|
|
570
|
+
* ```
|
|
571
|
+
* @param measure - Measure to apply difference to
|
|
355
572
|
* @param name - Name for the new measure
|
|
356
|
-
* @returns A
|
|
573
|
+
* @returns A calculated measure instance
|
|
357
574
|
*/
|
|
358
575
|
export declare function difference(measure: Measure, name?: string): CalculatedMeasure;
|
|
359
576
|
/**
|
|
360
|
-
*
|
|
361
|
-
*
|
|
577
|
+
* Creates a calculated measure that calculates the difference between this week's data
|
|
578
|
+
* and the data from the previous week for the given measure.
|
|
362
579
|
*
|
|
580
|
+
* The date dimension will be dynamically taken from the query that uses the returned measure.
|
|
581
|
+
*
|
|
582
|
+
* @example
|
|
583
|
+
* Calculate the difference between this week's total cost and the previous week's total cost from
|
|
584
|
+
* the Sample Ecommerce data model.
|
|
585
|
+
* ```ts
|
|
586
|
+
* measureFactory.diffPastWeek(measureFactory.sum(DM.Commerce.Cost))
|
|
587
|
+
* ```
|
|
363
588
|
* @param measure - Measure to apply difference to
|
|
364
589
|
* @param name - Name for the new measure
|
|
365
|
-
* @returns A
|
|
590
|
+
* @returns A calculated measure instance
|
|
366
591
|
*/
|
|
367
592
|
export declare function diffPastWeek(measure: Measure, name?: string): CalculatedMeasure;
|
|
368
593
|
/**
|
|
369
|
-
*
|
|
370
|
-
*
|
|
594
|
+
* Creates a calculated measure that calculates the difference between this month's data
|
|
595
|
+
* and the data from the previous month for the given measure.
|
|
596
|
+
*
|
|
597
|
+
* The date dimension will be dynamically taken from the query that uses the returned measure.
|
|
371
598
|
*
|
|
599
|
+
* @example
|
|
600
|
+
* Calculate the difference between this month's total cost and the previous month's total cost from
|
|
601
|
+
* the Sample Ecommerce data model.
|
|
602
|
+
* ```ts
|
|
603
|
+
* measureFactory.diffPastMonth(measureFactory.sum(DM.Commerce.Cost))
|
|
604
|
+
* ```
|
|
372
605
|
* @param measure - Measure to apply difference to
|
|
373
606
|
* @param name - Name for the new measure
|
|
374
|
-
* @returns A
|
|
607
|
+
* @returns A calculated measure instance
|
|
375
608
|
*/
|
|
376
609
|
export declare function diffPastMonth(measure: Measure, name?: string): CalculatedMeasure;
|
|
377
610
|
/**
|
|
378
|
-
*
|
|
379
|
-
*
|
|
611
|
+
* Creates a calculated measure that calculates the difference between this quarter's data
|
|
612
|
+
* and the data from the previous quarter for the given measure.
|
|
380
613
|
*
|
|
614
|
+
* The date dimension will be dynamically taken from the query that uses the returned measure.
|
|
615
|
+
*
|
|
616
|
+
* @example
|
|
617
|
+
* Calculate the difference between this quarter's total cost and the previous quarter's total cost
|
|
618
|
+
* from the Sample Ecommerce data model.
|
|
619
|
+
* ```ts
|
|
620
|
+
* measureFactory.diffPastQuarter(measureFactory.sum(DM.Commerce.Cost))
|
|
621
|
+
* ```
|
|
381
622
|
* @param measure - Measure to apply difference to
|
|
382
623
|
* @param name - Name for the new measure
|
|
383
|
-
* @returns A
|
|
624
|
+
* @returns A calculated measure instance
|
|
384
625
|
*/
|
|
385
626
|
export declare function diffPastQuarter(measure: Measure, name?: string): CalculatedMeasure;
|
|
386
627
|
/**
|
|
387
|
-
*
|
|
388
|
-
*
|
|
628
|
+
* Creates a calculated measure that calculates the difference between this year's data
|
|
629
|
+
* and the data from the previous year for the given measure.
|
|
630
|
+
*
|
|
631
|
+
* The date dimension will be dynamically taken from the query that uses the returned measure.
|
|
389
632
|
*
|
|
633
|
+
* @example
|
|
634
|
+
* Calculate the difference between this year's total cost and the previous year's total cost from
|
|
635
|
+
* the Sample Ecommerce data model.
|
|
636
|
+
* ```ts
|
|
637
|
+
* measureFactory.diffPastYear(measureFactory.sum(DM.Commerce.Cost))
|
|
638
|
+
* ```
|
|
390
639
|
* @param measure - Measure to apply difference to
|
|
391
640
|
* @param name - Name for the new measure
|
|
392
|
-
* @returns A
|
|
641
|
+
* @returns A calculated measure instance
|
|
393
642
|
*/
|
|
394
643
|
export declare function diffPastYear(measure: Measure, name?: string): CalculatedMeasure;
|
|
395
644
|
/**
|
|
396
|
-
*
|
|
397
|
-
* Date dimension will be dynamically taken from the query.
|
|
645
|
+
* Creates a calculated measure that calculates the value for the previous day.
|
|
398
646
|
*
|
|
647
|
+
* @example
|
|
648
|
+
* Calculate total cost for the previous day from the Sample Ecommerce data model.
|
|
649
|
+
* ```ts
|
|
650
|
+
* measureFactory.pastDay(measureFactory.sum(DM.Commerce.Cost))
|
|
651
|
+
* ```
|
|
399
652
|
* @param measure - Measure to apply past value to
|
|
400
653
|
* @param name - Name for the new measure
|
|
401
|
-
* @returns A
|
|
654
|
+
* @returns A calculated measure instance
|
|
402
655
|
*/
|
|
403
656
|
export declare function pastDay(measure: Measure, name?: string): CalculatedMeasure;
|
|
404
657
|
/**
|
|
405
|
-
*
|
|
406
|
-
*
|
|
658
|
+
* Creates a calculated measure that calculates the value for the same day in the previous week.
|
|
659
|
+
*
|
|
660
|
+
* The time resolution is determined by the minimum date level of the date dimension in the query
|
|
661
|
+
* that uses the returned measure.
|
|
407
662
|
*
|
|
663
|
+
* @example
|
|
664
|
+
* Calculate total cost for the corresponding day one week ago from the Sample Ecommerce data model.
|
|
665
|
+
* ```ts
|
|
666
|
+
* measureFactory.pastWeek(measureFactory.sum(DM.Commerce.Cost))
|
|
667
|
+
* ```
|
|
408
668
|
* @param measure - Measure to apply past value to
|
|
409
669
|
* @param name - Name for the new measure
|
|
410
|
-
* @returns A
|
|
670
|
+
* @returns A calculated measure instance
|
|
411
671
|
*/
|
|
412
672
|
export declare function pastWeek(measure: Measure, name?: string): CalculatedMeasure;
|
|
413
673
|
/**
|
|
414
|
-
*
|
|
415
|
-
* Date dimension will be dynamically taken from the query.
|
|
674
|
+
* Creates a calculated measure that calculates the value for the same day or week in the previous month.
|
|
416
675
|
*
|
|
676
|
+
* The time resolution is determined by the minimum date level of the date dimension in the query
|
|
677
|
+
* that uses the returned measure.
|
|
678
|
+
*
|
|
679
|
+
* @example
|
|
680
|
+
* Calculate total cost for the corresponding day or week one month ago from the Sample Ecommerce
|
|
681
|
+
* data model.
|
|
682
|
+
* ```ts
|
|
683
|
+
* measureFactory.pastMonth(measureFactory.sum(DM.Commerce.Cost))
|
|
684
|
+
* ```
|
|
417
685
|
* @param measure - Measure to apply past value to
|
|
418
686
|
* @param name - Name for the new measure
|
|
419
|
-
* @returns A
|
|
687
|
+
* @returns A calculated measure instance
|
|
420
688
|
*/
|
|
421
689
|
export declare function pastMonth(measure: Measure, name?: string): CalculatedMeasure;
|
|
422
690
|
/**
|
|
423
|
-
*
|
|
424
|
-
*
|
|
691
|
+
* Creates a calculated measure that calculates the value for the same day, week, or month in the previous quarter.
|
|
692
|
+
*
|
|
693
|
+
* The time resolution is determined by the minimum date level of the date dimension in the query
|
|
694
|
+
* that uses the returned measure.
|
|
425
695
|
*
|
|
696
|
+
* @example
|
|
697
|
+
* Calculate total cost for the corresponding day, week, or month one quarter ago from the Sample
|
|
698
|
+
* Ecommerce data model.
|
|
699
|
+
* ```ts
|
|
700
|
+
* measureFactory.pastQuarter(measureFactory.sum(DM.Commerce.Cost))
|
|
701
|
+
* ```
|
|
426
702
|
* @param measure - Measure to apply past value to
|
|
427
703
|
* @param name - Name for the new measure
|
|
428
|
-
* @returns A
|
|
704
|
+
* @returns A calculated measure instance
|
|
429
705
|
*/
|
|
430
706
|
export declare function pastQuarter(measure: Measure, name?: string): CalculatedMeasure;
|
|
431
707
|
/**
|
|
432
|
-
*
|
|
433
|
-
* Date dimension will be dynamically taken from the query.
|
|
708
|
+
* Creates a calculated measure that calculates the value for the same day, week, month, or quarter in the previous year.
|
|
434
709
|
*
|
|
710
|
+
* The time resolution is determined by the minimum date level of the date dimension in the query
|
|
711
|
+
* that uses the returned measure.
|
|
712
|
+
*
|
|
713
|
+
* @example
|
|
714
|
+
* Calculate total cost for the corresponding day, week, month, or quarter one year ago from the
|
|
715
|
+
* Sample Ecommerce data model.
|
|
716
|
+
* ```ts
|
|
717
|
+
* measureFactory.pastYear(measureFactory.sum(DM.Commerce.Cost))
|
|
718
|
+
* ```
|
|
435
719
|
* @param measure - Measure to apply past value to
|
|
436
720
|
* @param name - Name for the new measure
|
|
437
|
-
* @returns A
|
|
721
|
+
* @returns A calculated measure instance
|
|
438
722
|
*/
|
|
439
723
|
export declare function pastYear(measure: Measure, name?: string): CalculatedMeasure;
|
|
440
724
|
/**
|
|
441
|
-
*
|
|
725
|
+
* Creates a calculated contribution measure.
|
|
726
|
+
*
|
|
727
|
+
* A contribution measure calculates the contribution, in percentage, of a measure towards the total.
|
|
728
|
+
* Percentages are expressed as a number between 0 and 1 (e.g. 42% is `0.42`).
|
|
442
729
|
*
|
|
730
|
+
* For example, using the Sample Ecommerce data model you can retrieve the total cost of products
|
|
731
|
+
* categorized by age range. Using a contribution measure you can calculate how much each age range's
|
|
732
|
+
* total cost contributes to the total cost across all age ranges. So, the total cost for the 35-44
|
|
733
|
+
* age range is 23.64M, which is 22% of the 107.27M of all age ranges together. Therefore, the
|
|
734
|
+
* contribution of the 35-44 age range is `.22`.
|
|
735
|
+
*
|
|
736
|
+
* @example
|
|
737
|
+
* Calculates the percentage of the total cost across all categories for items in a category from the
|
|
738
|
+
* Sample Ecommerce data model.
|
|
739
|
+
* ```ts
|
|
740
|
+
* measureFactory.contribution(measureFactory.sum(DM.Commerce.Cost))
|
|
741
|
+
* ```
|
|
742
|
+
*
|
|
743
|
+
* Contribution values from the Sample Ecommerce data model when categorizing by age range.
|
|
744
|
+
* | AgeRange | Cost | Contribution |
|
|
745
|
+
* | --- | --- | --- |
|
|
746
|
+
* | 0-18 | 4.32M | 0.04 |
|
|
747
|
+
* | 19-24 | 8.66M | 0.08 |
|
|
748
|
+
* | 25-34 | 21.19M | 0.2 |
|
|
749
|
+
* | 35-44 | 23.64M | 0.22 |
|
|
750
|
+
* | 45-54 | 20.39M | 0.19 |
|
|
751
|
+
* | 55-64 | 11.82M | 0.11 |
|
|
752
|
+
* | 65+ | 17.26M | 0.16 |
|
|
443
753
|
* @param measure - Measure to apply the Contribution logic to
|
|
444
754
|
* @param name - Name for the new measure
|
|
445
|
-
* @returns A
|
|
755
|
+
* @returns A calculated measure instance
|
|
446
756
|
*/
|
|
447
757
|
export declare function contribution(measure: Measure, name?: string): CalculatedMeasure;
|
|
448
758
|
/**
|
|
449
|
-
*
|
|
450
|
-
*
|
|
451
|
-
*
|
|
759
|
+
* Creates a calculated measure that computes a specified trend type for a given measure.
|
|
760
|
+
*
|
|
761
|
+
* The trend types include linear (the default), logarithmic, advanced smoothing, and local estimates.
|
|
762
|
+
* You can also opt to automatically identify and ignore anomalous values in the series.
|
|
452
763
|
*
|
|
453
764
|
* Trend requires a Sisense instance version of L2023.6.0 or greater.
|
|
454
765
|
*
|
|
766
|
+
* @example
|
|
767
|
+
* Calculate the trend in total cost from the Sample Ecommerce data model.
|
|
768
|
+
* ```ts
|
|
769
|
+
* measureFactory.trend(
|
|
770
|
+
* measureFactory.sum(DM.Commerce.Cost),
|
|
771
|
+
* 'Total Cost Trend',
|
|
772
|
+
* {
|
|
773
|
+
* modelType: 'advancedSmoothing',
|
|
774
|
+
* ignoreAnomalies: true,
|
|
775
|
+
* }
|
|
776
|
+
* )
|
|
777
|
+
* ```
|
|
455
778
|
* @param measure - Measure to apply the trend logic to
|
|
456
779
|
* @param name - Name for the new measure
|
|
457
780
|
* @param options - Trend options
|
|
458
|
-
* @returns A
|
|
781
|
+
* @returns A calculated measure instance
|
|
459
782
|
*/
|
|
460
783
|
export declare function trend(measure: Measure, name?: string, options?: TrendFormulaOptions): CalculatedMeasure;
|
|
461
784
|
/**
|
|
462
|
-
*
|
|
463
|
-
*
|
|
785
|
+
* Creates a calculated measure that generates a forecast based on a specified measure employing
|
|
786
|
+
* advanced autoML techniques.
|
|
464
787
|
*
|
|
465
|
-
* This function offers
|
|
466
|
-
* statistical model or
|
|
467
|
-
*
|
|
468
|
-
* improve forecast accuracy by supplying expected lower and upper limits.
|
|
788
|
+
* This function offers flexible options allowing you to:
|
|
789
|
+
* + Let the function auto-select the best statistical model or explicitly choose a preferred model
|
|
790
|
+
* + Control the time period used for training the model
|
|
791
|
+
* + Set additional options to improve forecast accuracy by supplying expected lower and upper limits.
|
|
469
792
|
*
|
|
470
|
-
* In addition to forecast, upper and lower confidence
|
|
793
|
+
* In addition to the forecast, upper and lower confidence intervals are returned
|
|
471
794
|
* with the name of the new measure and a suffix of _upper and _lower
|
|
472
795
|
* respectively.
|
|
473
796
|
*
|
|
474
797
|
* Forecast requires a Sisense instance version of L2023.6.0 or greater.
|
|
475
798
|
*
|
|
799
|
+
* @example
|
|
800
|
+
* Calculate a forecast for total cost from the Sample Ecommerce data model from the Sample
|
|
801
|
+
* Ecommerce data model.
|
|
802
|
+
* ```ts
|
|
803
|
+
* measureFactory.forecast(
|
|
804
|
+
* measureFactory.sum(DM.Commerce.Cost),
|
|
805
|
+
* 'Total Cost Forecast',
|
|
806
|
+
* {
|
|
807
|
+
* modelType: 'prophet',
|
|
808
|
+
* roundToInt: true,
|
|
809
|
+
* }
|
|
810
|
+
* )
|
|
811
|
+
* ```
|
|
476
812
|
* @param measure - Measure to apply the forecast logic to
|
|
477
813
|
* @param name - Name for the new measure
|
|
478
814
|
* @param options - Forecast options
|
|
479
|
-
* @returns A
|
|
815
|
+
* @returns A calculated measure instance
|
|
480
816
|
*/
|
|
481
817
|
export declare function forecast(measure: Measure, name?: string, options?: ForecastFormulaOptions): CalculatedMeasure;
|
|
482
818
|
/**
|
|
483
|
-
*
|
|
819
|
+
* Creates a calculated measure that calculates the rank of a value in a list of values.
|
|
820
|
+
*
|
|
821
|
+
* This function includes options that allow you do customize the ranking order and how to handle
|
|
822
|
+
* equally ranked items.
|
|
823
|
+
*
|
|
824
|
+
* The order options are:
|
|
825
|
+
* + `'DESC'` (default): Descending, meaning the largest number is ranked first.
|
|
826
|
+
* + `'ASC'`: Ascending, meaning the smallest number is ranked first.
|
|
827
|
+
*
|
|
828
|
+
* The rank type options are:
|
|
829
|
+
* + `'1224'`: Standard competition, meaning items that rank equally receive the same ranking number,
|
|
830
|
+
* and then a gap is left after the equally ranked items in the ranking numbers.
|
|
831
|
+
* + `'1334'`: Modified competition ranking, meaning items that rank equally receive the same ranking number,
|
|
832
|
+
* and a gap is left before the equally ranked items in the ranking numbers.
|
|
833
|
+
* + `'1223'`: Dense ranking, meaning items that rank equally receive the same ranking number,
|
|
834
|
+
* and the next items receive the immediately following ranking number.
|
|
835
|
+
* + `'1234'`: Ordinal ranking, meaning all items receive distinct ordinal numbers,
|
|
836
|
+
* including items that rank equally. The assignment of distinct ordinal numbers for equal-ranking items is arbitrary.
|
|
484
837
|
*
|
|
485
838
|
* @example
|
|
486
|
-
*
|
|
487
|
-
*
|
|
488
|
-
*
|
|
839
|
+
* Calculate the rank of the total cost per category, sorted with the smallest cost ranked first,
|
|
840
|
+
* and ranking ties are handled using the ordinal ranking type from the Sample Ecommerce data model.
|
|
841
|
+
* ```ts
|
|
842
|
+
* measureFactory.rank(
|
|
843
|
+
* measureFactory.sum(DM.Commerce.Cost),
|
|
844
|
+
* 'Cost Rank',
|
|
845
|
+
* measureFactory.RankingSortTypes.Ascending,
|
|
846
|
+
* measureFactory.RankingTypes.Ordinal
|
|
847
|
+
* )
|
|
848
|
+
* ```
|
|
849
|
+
*
|
|
850
|
+
* Ranking values from the Sample Ecommerce data model when categorizing by age range using the above ranking.
|
|
851
|
+
* | AgeRange | Cost | Cost Rank |
|
|
852
|
+
* | --- | --- | --- |
|
|
853
|
+
* | 0-18 | 4.32M | 1 |
|
|
854
|
+
* | 19-24 | 8.66M | 2 |
|
|
855
|
+
* | 25-34 | 21.19M | 6 |
|
|
856
|
+
* | 35-44 | 23.64M | 7 |
|
|
857
|
+
* | 45-54 | 20.39M | 5 |
|
|
858
|
+
* | 55-64 | 11.82M | 3 |
|
|
859
|
+
* | 65+ | 17.26M | 4 |
|
|
860
|
+
* @param measure - Measure to apply the ranking logic to
|
|
489
861
|
* @param name - Name for the new measure
|
|
490
|
-
* @param sort - By default sort order is descending.
|
|
491
|
-
* @param rankType - By default the type is standard competition ranking
|
|
492
|
-
*
|
|
493
|
-
*
|
|
494
|
-
* @param groupBy - Rank partitions attributes
|
|
495
|
-
* @returns A rank measure
|
|
862
|
+
* @param sort - Sorting for ranking. By default sort order is descending, where the largest number is ranked first.
|
|
863
|
+
* @param rankType - How to handle equally ranked items. By default the type is standard competition ranking.
|
|
864
|
+
* @param groupBy - Rank partition attributes
|
|
865
|
+
* @returns A calculated measure instance
|
|
496
866
|
*/
|
|
497
867
|
export declare function rank(measure: Measure, name?: string, sort?: string, rankType?: string, groupBy?: Attribute[]): CalculatedMeasure;
|