@sisense/sdk-data 0.16.0 → 1.1.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.
@@ -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 compare equal receive the same ranking number, and then a gap is left in the ranking numbers.
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
- * Sometimes, competition ranking is done by leaving the gaps in the ranking numbers before the sets of equal-ranking items (rather than after them as in standard competition ranking)
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 compare equally receive the same ranking number, and the next items receive the immediately following ranking number.
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 compare equal. The assignment of distinct ordinal numbers is arbitrarily.
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 [valid custom formula](https://docs.sisense.com/main/SisenseLinux/dashboard-functions-reference.htm).
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
- * Note: Shared formula must be fetched prior to use (see {@link @sisense/sdk-ui!useGetSharedFormula | useGetSharedFormula}).
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 `customFormula` using dimensions, measures, and nested custom formulas:
48
- * ```tsx
49
- * const profitabilityRatio = measures.customFormula(
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: measures.sum(DM.Commerce.Revenue),
55
+ * totalRevenue: measureFactory.sum(DM.Commerce.Revenue),
54
56
  * cost: DM.Commerce.Cost,
55
57
  * },
56
58
  * );
57
59
  *
58
- * const profitabilityRatioRank = measures.customFormula(
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 object that may be used in a chart or a query
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 a basic aggregated measure.
97
- * This is a base function to build other aggregation functions (e.g., `sum`, `average`, etc)
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 - Numeric formatting to apply
104
- * @returns A Measure instance
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
- * Returns a numeric value as a measure.
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 Calculated Measure instance
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 Measure instance
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 Measure instance
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 Measure instance
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 Measure instance
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 Measure instance
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 Measure instance
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 Measure instance
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 Calculated Measure instance
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
- * Adds the two given values.
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 Calculated Measure instance
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
- * Subtract value2 from value1.
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 Calculated Measure instance
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
- * Multiply value1 with value2.
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 Calculated Measure instance
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
- * Divide value1 by value2.
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 Calculated Measure instance
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
- * Calculates year to date (YTD) sum of the given measure. Date dimension will be dynamically taken from the query.
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 Calculated Measure instance
315
+ * @returns A calculated measure instance
233
316
  */
234
317
  export declare function yearToDateSum(measure: Measure, name?: string): CalculatedMeasure;
235
318
  /**
236
- * Calculates quarter to date (QTD) sum of the given measure.
237
- * Date dimension will be dynamically taken from the query.
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 Calculated Measure instance
333
+ * @returns A calculated measure instance
242
334
  */
243
335
  export declare function quarterToDateSum(measure: Measure, name?: string): CalculatedMeasure;
244
336
  /**
245
- * Calculates month to date (MTD) sum of the given measure.
246
- * Date dimension will be dynamically taken from the query.
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 Calculated Measure instance
351
+ * @returns A calculated measure instance
251
352
  */
252
353
  export declare function monthToDateSum(measure: Measure, name?: string): CalculatedMeasure;
253
354
  /**
254
- * Calculates week to date (WTD) sum of the given measure.
255
- * Date dimension will be dynamically taken from the query.
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 Calculated Measure instance
369
+ * @returns A calculated measure instance
260
370
  */
261
371
  export declare function weekToDateSum(measure: Measure, name?: string): CalculatedMeasure;
262
372
  /**
263
- * Returns the running total of the measure by the defined dimension
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
- * By default, `RSUM` accumulates a measure by the sorting order of the dimension.
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
- * Note: Filtering the `RSUM` column by Values,
270
- * filters the dimensions and recalculates the `RSUM` from the first filtered value.
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
- * @param measure - Measure to apply the Running Sum to
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 False.
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 Calculated Measure instance
397
+ * @returns A calculated measure instance
277
398
  */
278
399
  export declare function runningSum(measure: Measure, _continuous?: boolean, name?: string): CalculatedMeasure;
279
400
  /**
280
- * Calculates growth over time. The time dimension to be used is determined by the time resolution in the query.
401
+ * Creates a calculated measure that calculates growth over a period of time.
281
402
  *
282
- * Formula: `(current value compared value) / compared value`.
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
- * @example
406
+ * Growth is calculated using the following formula: `(currentPeriod – previousPeriod) / previousPeriod`.
285
407
  *
286
- * If this month your value is 12, and last month it was 10, your Growth for this month is 20% (0.2).
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
- * Calculation: `(12 10) / 10 = 0.2`
411
+ * If the previous period's value is greater than the current period, the growth will be negative.
289
412
  *
290
- * If this year your value is 80, and last year it was 100, your Growth for this year is -20% ( -0.2).
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
- * Calculation: `(80 – 100) / 100 = -0.2`
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 Calculated Measure instance
424
+ * @returns A calculated measure instance
296
425
  */
297
426
  export declare function growth(measure: Measure, name?: string): CalculatedMeasure;
298
427
  /**
299
- * Calculates growth rate over time. The time dimension to be used is determined by the time resolution in the query.
428
+ * Creates a calculated measure that calculates growth rate over a period of time.
300
429
  *
301
- * @example
302
- * If this month your value is 12, and last month it was 10, your Growth Rate for this month is 12/10 = 120% (1.2).
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
- * Calculation: `12 / 10 = 1.2`
433
+ * Growth rate is calculated using the following formula: `currentPeriod / previousPeriod`.
305
434
  *
306
- * If this year your value is 80, and last year it was 100, your Growth for this year is 80/100 = 80% ( 0.8).
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
- * Calculation: `80 / 100 = 0.8`
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 Calculated Measure instance
451
+ * @returns A calculated measure instance
312
452
  */
313
453
  export declare function growthRate(measure: Measure, name?: string): CalculatedMeasure;
314
454
  /**
315
- * Calculates the growth from past week of the given measure.
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 Calculated Measure instance
477
+ * @returns A calculated measure instance
321
478
  */
322
479
  export declare function growthPastWeek(measure: Measure, name?: string): CalculatedMeasure;
323
480
  /**
324
- * Calculates the growth from past month of the given measure.
325
- * Date dimension will be dynamically taken from the query
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 Calculated Measure instance
503
+ * @returns A calculated measure instance
330
504
  */
331
505
  export declare function growthPastMonth(measure: Measure, name?: string): CalculatedMeasure;
332
506
  /**
333
- * Calculates the growth from past quarter of the given measure.
334
- * Date dimension will be dynamically taken from the query.
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 Calculated Measure instance
529
+ * @returns A calculated measure instance
339
530
  */
340
531
  export declare function growthPastQuarter(measure: Measure, name?: string): CalculatedMeasure;
341
532
  /**
342
- * Calculates the growth from past year of the given measure.
343
- * Date dimension will be dynamically taken from the query.
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 Calculated Measure instance
555
+ * @returns A calculated measure instance
348
556
  */
349
557
  export declare function growthPastYear(measure: Measure, name?: string): CalculatedMeasure;
350
558
  /**
351
- * Calculates the difference of the given measure.
352
- * Date dimension will be dynamically taken from the query.
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
- * @param measure - measure to apply difference to
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 Calculated Measure instance
573
+ * @returns A calculated measure instance
357
574
  */
358
575
  export declare function difference(measure: Measure, name?: string): CalculatedMeasure;
359
576
  /**
360
- * Calculates the difference from past week of the given measure.
361
- * Ddate dimension will be dynamically taken from the query.
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 Calculated Measure instance
590
+ * @returns A calculated measure instance
366
591
  */
367
592
  export declare function diffPastWeek(measure: Measure, name?: string): CalculatedMeasure;
368
593
  /**
369
- * Calculates the difference from past month of the given measure.
370
- * Date dimension will be dynamically taken from the query.
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 Calculated Measure instance
607
+ * @returns A calculated measure instance
375
608
  */
376
609
  export declare function diffPastMonth(measure: Measure, name?: string): CalculatedMeasure;
377
610
  /**
378
- * Calculates the difference from past quarter of the given measure.
379
- * Date dimension will be dynamically taken from the query.
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 Calculated Measure instance
624
+ * @returns A calculated measure instance
384
625
  */
385
626
  export declare function diffPastQuarter(measure: Measure, name?: string): CalculatedMeasure;
386
627
  /**
387
- * Calculates the difference from past year of the given measure.
388
- * Date dimension will be dynamically taken from the query.
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 Calculated Measure instance
641
+ * @returns A calculated measure instance
393
642
  */
394
643
  export declare function diffPastYear(measure: Measure, name?: string): CalculatedMeasure;
395
644
  /**
396
- * Calculates the value of the past day of the given measure.
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 Calculated Measure instance
654
+ * @returns A calculated measure instance
402
655
  */
403
656
  export declare function pastDay(measure: Measure, name?: string): CalculatedMeasure;
404
657
  /**
405
- * Calculates the value of the past week of the given measure.
406
- * Date dimension will be dynamically taken from the query.
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 Calculated Measure instance
670
+ * @returns A calculated measure instance
411
671
  */
412
672
  export declare function pastWeek(measure: Measure, name?: string): CalculatedMeasure;
413
673
  /**
414
- * Calculates the value of the path month of the given measure.
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 Calculated Measure instance
687
+ * @returns A calculated measure instance
420
688
  */
421
689
  export declare function pastMonth(measure: Measure, name?: string): CalculatedMeasure;
422
690
  /**
423
- * Calculates the value of the past quarter of the given measure.
424
- * Date dimension will be dynamically taken from the query.
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 Calculated Measure instance
704
+ * @returns A calculated measure instance
429
705
  */
430
706
  export declare function pastQuarter(measure: Measure, name?: string): CalculatedMeasure;
431
707
  /**
432
- * Calculates the value of the past year of the given measure.
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 Calculated Measure instance
721
+ * @returns A calculated measure instance
438
722
  */
439
723
  export declare function pastYear(measure: Measure, name?: string): CalculatedMeasure;
440
724
  /**
441
- * Calculates contribution.
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 Calculated Measure instance
755
+ * @returns A calculated measure instance
446
756
  */
447
757
  export declare function contribution(measure: Measure, name?: string): CalculatedMeasure;
448
758
  /**
449
- * Fits a specified trend type to your measure. The trend types include linear,
450
- * logarithmic, advanced smoothing, and local estimates. It allows for an optional
451
- * feature to automatically identify and ignore anomalous values in the series.
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 Calculated Measure instance
781
+ * @returns A calculated measure instance
459
782
  */
460
783
  export declare function trend(measure: Measure, name?: string, options?: TrendFormulaOptions): CalculatedMeasure;
461
784
  /**
462
- * Calculates Forecast leveraging advanced autoML techniques to generate
463
- * a forecast for a given measure.
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 flexibility with auto-selection of the best
466
- * statistical model or user-selected models, and it also provides control
467
- * over the time period used for training the model, as well as options to
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 interval is returned
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 Calculated Measure instance
815
+ * @returns A calculated measure instance
480
816
  */
481
817
  export declare function forecast(measure: Measure, name?: string, options?: ForecastFormulaOptions): CalculatedMeasure;
482
818
  /**
483
- * Calculates the rank of a value in a list of values.
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
- * `RANK(Total Cost, “ASC”, “1224”, Product, Years)`
487
- * will return the rank of the total annual cost per each product were sorted in ascending order.
488
- * @param measure - Measure to apply the Contribution logic to
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 `(“1224” ranking)`.
492
- * Supports also modified competition ranking `(“1334” ranking)`, dense ranking `(“1223” ranking)`,
493
- * and ordinal ranking `(“1234” ranking)`.
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;