DAX 查询根据现有 TOPN 表显示新的销售数据

问题描述 投票:0回答:1
DAX query: I have a slicer 'week', a calculated column of sales for 'Top_5 regions'. In a table   I add region and 'Top_5 regions' calculated column and it displays the region and its sales. To that corresponding regions alone, I need to display sales of product_2 in same table. If I simply add the product_2 sales all regions sales values are displayed. I need to display for existing top 5 regions alone. Also, when week slicer changes, the region changes and the product 2 sales values should also change accordingly.


DAX for TOP5:

Top 5 Regions = 
IF(
[Region Rank] <= 5,
[ProductA_Sales],
BLANK()
)
`

` Sample table

Region  Team  Product A_Sales   Product B_Sales
 A        abc       250               780
 B        xyx       900               870
 C        yuj       124               145
 D        ert       45                54
 E        ret       654               145
 F        tyk       12                456

 
产品_A_销售额 = SUM(销售额[产品_A])

`
Region Rank = 
RANKX(
ALLSELECTED(Sales[Region]), 
Sales[Product_A_sales], 
, 
DESC, 
DENSE
)
`

DAX for TOP5:

Top 5 Regions = 
IF(
[Region Rank] <= 5,
[ProductA_Sales],
BLANK()
)
`

`Sample table

 Region  Team  Product A_Sales   Product B_Sales
A        abc       250               780
B        xyx       900               870
C        yuj       124               145
D        ert       45                54
E        ret       654               145
F        tyk       12                456

`

预期结果:

Region  Team  Product A_Sales   Product B_Sales
B        xyx       900               870
E        ret       654               145
A        abc       250               780
C        yuj       124               145
D        ert       45                54
powerbi powerbi-desktop
1个回答
0
投票

您可以尝试在视觉过滤器中设置TOPN

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.