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
| Rank_按综合指标 = VAR xs = SWITCH(TRUE(), ISFILTERED('Product'[category]), RANKX(ALLSELECTED('Product'[category]),[销售金额]), ISFILTERED('Product'[Subcategory]), RANKX(ALLSELECTED('Product'[Subcategory]),[销售金额]), ISFILTERED('Product'[Model]),RANKX(ALLSELECTED('Product'[Model]),[销售金额]), ISFILTERED('Product'[Product]), RANKX(ALLSELECTED('Product'[Product]),[销售金额]), ISFILTERED('Product'[SKU]), RANKX(ALLSELECTED('Product'[SKU]),[销售金额]), ISFILTERED('Customer'[Customer]), RANKX(ALLSELECTED('Customer'[Customer]),[销售金额]), ISFILTERED('Reseller'[Reseller]), RANKX(ALLSELECTED('Reseller'[Reseller]),[销售金额]), ISFILTERED('Sales Territory'[Country]), RANKX(ALLSELECTED('Sales Territory'[Country]),[销售金额]), BLANK()) VAR dg = SWITCH(TRUE(), ISFILTERED('Product'[category]), RANKX(ALLSELECTED('Product'[category]),[订购数量]), ISFILTERED('Product'[Subcategory]), RANKX(ALLSELECTED('Product'[Subcategory]),[订购数量]), ISFILTERED('Product'[Model]),RANKX(ALLSELECTED('Product'[Model]),[订购数量]), ISFILTERED('Product'[Product]), RANKX(ALLSELECTED('Product'[Product]),[订购数量]), ISFILTERED('Product'[SKU]), RANKX(ALLSELECTED('Product'[SKU]),[订购数量]), ISFILTERED('Customer'[Customer]), RANKX(ALLSELECTED('Customer'[Customer]),[订购数量]), ISFILTERED('Reseller'[Reseller]), RANKX(ALLSELECTED('Reseller'[Reseller]),[订购数量]), ISFILTERED('Sales Territory'[Country]), RANKX(ALLSELECTED('Sales Territory'[Country]),[订购数量]), BLANK()) VAR cb = SWITCH(TRUE(), ISFILTERED('Product'[category]), RANKX(ALLSELECTED('Product'[category]),[成本]), ISFILTERED('Product'[Subcategory]), RANKX(ALLSELECTED('Product'[Subcategory]),[成本]), ISFILTERED('Product'[Model]),RANKX(ALLSELECTED('Product'[Model]),[成本]), ISFILTERED('Product'[Product]), RANKX(ALLSELECTED('Product'[Product]),[成本]), ISFILTERED('Product'[SKU]), RANKX(ALLSELECTED('Product'[SKU]),[成本]), ISFILTERED('Customer'[Customer]), RANKX(ALLSELECTED('Customer'[Customer]),[成本]), ISFILTERED('Reseller'[Reseller]), RANKX(ALLSELECTED('Reseller'[Reseller]),[成本]), ISFILTERED('Sales Territory'[Country]), RANKX(ALLSELECTED('Sales Territory'[Country]),[成本]), BLANK()) VAR lr = SWITCH(TRUE(), ISFILTERED('Product'[category]), RANKX(ALLSELECTED('Product'[category]),[利润]), ISFILTERED('Product'[Subcategory]), RANKX(ALLSELECTED('Product'[Subcategory]),[利润]), ISFILTERED('Product'[Model]),RANKX(ALLSELECTED('Product'[Model]),[利润]), ISFILTERED('Product'[Product]), RANKX(ALLSELECTED('Product'[Product]),[利润]), ISFILTERED('Product'[SKU]), RANKX(ALLSELECTED('Product'[SKU]),[利润]), ISFILTERED('Customer'[Customer]), RANKX(ALLSELECTED('Customer'[Customer]),[利润]), ISFILTERED('Reseller'[Reseller]), RANKX(ALLSELECTED('Reseller'[Reseller]),[利润]), ISFILTERED('Sales Territory'[Country]), RANKX(ALLSELECTED('Sales Territory'[Country]),[利润]), BLANK()) VAR kd = SWITCH(TRUE(), ISFILTERED('Product'[category]), RANKX(ALLSELECTED('Product'[category]),[客单金额]), ISFILTERED('Product'[Subcategory]), RANKX(ALLSELECTED('Product'[Subcategory]),[客单金额]), ISFILTERED('Product'[Model]),RANKX(ALLSELECTED('Product'[Model]),[客单金额]), ISFILTERED('Product'[Product]), RANKX(ALLSELECTED('Product'[Product]),[客单金额]), ISFILTERED('Product'[SKU]), RANKX(ALLSELECTED('Product'[SKU]),[客单金额]), ISFILTERED('Customer'[Customer]), RANKX(ALLSELECTED('Customer'[Customer]),[客单金额]), ISFILTERED('Reseller'[Reseller]), RANKX(ALLSELECTED('Reseller'[Reseller]),[客单金额]), ISFILTERED('Sales Territory'[Country]), RANKX(ALLSELECTED('Sales Territory'[Country]),[客单金额]), BLANK()) RETURN SWITCH(TRUE(),SELECTEDVALUE('参数-指标'[参数-指标 个字段])="'Measure'[销售金额]",xs, SELECTEDVALUE('参数-指标'[参数-指标 个字段])="'Measure'[订购数量]",dg, SELECTEDVALUE('参数-指标'[参数-指标 个字段])="'Measure'[成本]",cb, SELECTEDVALUE('参数-指标'[参数-指标 个字段])="'Measure'[利润]",lr, SELECTEDVALUE('参数-指标'[参数-指标 个字段])="'Measure'[客单金额]",kd )
|