![]() Previous |
![]() Next |
A binary operator operates on two operands.
Here are two simple examples using numeric literals for the operands.
7 * 2
is 14
.
(8/2) + 1
is 5
.
This example multiplies the values of the Sales measure by a numeric literal to create a calculated measure named Sales Budget.
UNITS_CUBE.SALES * 1.06
Multiplication Operator Example
Product | Level | Sales | Sales Budget |
---|---|---|---|
Hardware |
CLASS |
124191336 |
131642816 |
Desktop PCs |
FAMILY |
74556528 |
79029919 |
Monitors |
FAMILY |
3972142 |
4210470 |
Memory |
FAMILY |
5619219 |
5956372 |
Modems/Fax |
FAMILY |
5575726 |
5910269 |
CD/DVD |
FAMILY |
16129497 |
17097267 |
Portable PCs |
FAMILY |
18338225 |
19438518 |
The next example creates a calculated measure named Profit by subtracting Cost from Sales.
UNITS_CUBE.SALES - UNITS_CUBE.COST
Product | Level | Sales | Cost | Profit |
---|---|---|---|---|
Hardware | CLASS | 124191336 | 116058248 | 8133088 |
Desktop PCs | FAMILY | 74556528 | 71937312 | 2619215 |
Monitors | FAMILY | 3972142 | 3546195 | 425947 |
Memory | FAMILY | 5619219 | 4962527 | 656692 |
Modems/Fax | FAMILY | 5575726 | 5162879 | 412847 |
CD/DVD | FAMILY | 16129497 | 12510832 | 3618664 |
Portable PCs | FAMILY | 18338225 | 17938502 | 399723 |