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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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