-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lab03 DAX.txt
64 lines (52 loc) · 1.82 KB
/
Lab03 DAX.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Product Rank =
RANKX(
ALL(DimProduct);
CALCULATE(FactInternetSales[Sales Revenue])
)
---------------------------------------------------------
Product Rank =
IF(
HASONEVALUE(DimProduct[EnglishProductName]);
RANKX(
ALL(DimProduct[ProductSubcategoryName];DimProduct[EnglishProductName]);
CALCULATE([Sales Revenue])
)
)
---------------------------------------------------------
CategoryImageURL = SWITCH(
TRUE();
DimProduct[ProductCategoryKey] = 1; "https://saobvion.blob.core.windows.net/adventureworks/Bikes.jpg";
DimProduct[ProductCategoryKey] = 2; "https://saobvion.blob.core.windows.net/adventureworks/Components.jpg";
DimProduct[ProductCategoryKey] = 3; "https://saobvion.blob.core.windows.net/adventureworks/Clothing.jpg";
DimProduct[ProductCategoryKey] = 4; "https://saobvion.blob.core.windows.net/adventureworks/Accessories.jpg";
"https://saobvion.blob.core.windows.net/adventureworks/Unknown.png"
)
---------------------------------------------------------
Product Rank =
IF(
HASONEVALUE(DimProduct[EnglishProductName]);
RANKX(
ALL(DimProduct[ProductSubcategoryName];DimProduct[EnglishProductName];DimProduct[CategoryImageURL]);
CALCULATE([Sales Revenue])
)
)
---------------------------------------------------------
Product Rank =
IF(
HASONEVALUE(DimProduct[EnglishProductName]);
RANKX(
ALLSELECTED(DimProduct);
CALCULATE([Sales Revenue])
)
)
---------------------------------------------------------
Order Count = COUNTROWS(FactInternetSales)
---------------------------------------------------------
Customer Rank =
IF(
HASONEVALUE(DimCustomer[FullName]);
RANKX(
ALLSELECTED(DimCustomer);
CALCULATE(FactInternetSales[Sales Revenue])
)
)