Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Giorgi1989
Advocate II
Advocate II

Help needed to retrieve data for Top 20 customers from multiple fact tables

Dear All,

 

I am trying to retrieve a list of Top 20 customers based on the actual sales, and then capture the figures from three different fact tables for these 20 customers (these are three separate cubes from SAP BW). 

 

The output I am looking for is shown below: 

 

Please, note that in the data model there are no direct relationships between the fact tables. 

 

Any tip/suggestion would be much appreciated. Thank you.

 

 Fact Table 1Fact Table 1Fact Table 1Fact Table 2Fact Table 3
CustomerSales 2019Sales 2020Sales 2021Bonuses 2021Forecast 2023
A500600700800900
B75085095010501150
C10001000100010001000
D20406080100
E1525354555
ETC.1213141516
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Giorgi1989 ,

Here are the steps you can follow:

1. Create measure.

Bonuses 2021 =
CALCULATE(SUM('Fact Table2'[Bonuses 2021]),FILTER(ALL('Fact Table2'),'Fact Table2'[Customer]=MAX('Fact Table1'[Customer])))
Forecast 2023 =
CALCULATE(SUM('Fact Table3'[Forecast 2023]),FILTER(ALL('Fact Table3'),'Fact Table3'[Customer]=MAX('Fact Table1'[Customer])))
Sum =
SUMX(FILTER(ALL('Fact Table1'),
'Fact Table1'[Customer]=MAX('Fact Table1'[Customer])),[Sales 2019]+[Sales 2020]+[Sales 2021]+[Bonuses 2021]+[Forecast 2023])
Rank =
RANKX(ALL('Fact Table1'),[Sum],,DESC)
Flag =
IF(
    [Rank]<=3,1,0)

2. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_0-1659062959880.png

3. Result:

vyangliumsft_1-1659062959882.png

 

If you need pbix, please click here.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi  @Giorgi1989 ,

Here are the steps you can follow:

1. Create measure.

Bonuses 2021 =
CALCULATE(SUM('Fact Table2'[Bonuses 2021]),FILTER(ALL('Fact Table2'),'Fact Table2'[Customer]=MAX('Fact Table1'[Customer])))
Forecast 2023 =
CALCULATE(SUM('Fact Table3'[Forecast 2023]),FILTER(ALL('Fact Table3'),'Fact Table3'[Customer]=MAX('Fact Table1'[Customer])))
Sum =
SUMX(FILTER(ALL('Fact Table1'),
'Fact Table1'[Customer]=MAX('Fact Table1'[Customer])),[Sales 2019]+[Sales 2020]+[Sales 2021]+[Bonuses 2021]+[Forecast 2023])
Rank =
RANKX(ALL('Fact Table1'),[Sum],,DESC)
Flag =
IF(
    [Rank]<=3,1,0)

2. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_0-1659062959880.png

3. Result:

vyangliumsft_1-1659062959882.png

 

If you need pbix, please click here.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.