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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
TKH8
New Member

Sum depending on dynamic top

Hello,

I have a problem that seemed easy to solve but i'm blocked.

 

I have a data source with 4 fields :

Network 

Shop (Shop is linked to a Network).

Sales Type 

Sale (equal to one).

 

Im trying to have a matrix wich display the Top 4 Sales Type with the associated number of sales with the shop as a segment.

I succeed to do it easily but now i would like to show in the matrix the number of sales by network for this sales type (the 4 that compose the top 4 for the selected Shop).

 

To ease the process I created a table that precalculate the Sales Type Top 4 for each Shop.

 

A simplified version of the source (in the original report I have more segments, year, month, Shop).

 

I created 4 objects to identify the Top 4 based on the Selected_Shop 

Top1_Type_select = CALCULATETABLE(DISTINCT(Tops[Top1]), FILTER(Tops,Tops[Shop]=[Selected_shop]))
Top2_Type_select = CALCULATETABLE(DISTINCT(Tops[Top2]), FILTER(Tops,Tops[Shop]=[Selected_shop]))
Top3_Type_select = CALCULATETABLE(DISTINCT(Tops[TOP3]), FILTER(Tops,Tops[Shop]=[Selected_shop]))
Top4_Type_select = CALCULATETABLE(DISTINCT(Tops[Top4]), FILTER(Tops,Tops[Shop]=[Selected_shop]))

 

And an object to get the total sales by type

Total_top_sales = calculate([Count], FILTER(Sales,Sales[Sales Type]=Tops[Top1_Type_select]))+calculate([Count], FILTER(Sales,Sales[Sales Type]=Tops[Top2_Type_select]))+calculate([Count], FILTER(Sales,Sales[Sales Type]=Tops[Top3_Type_select]))+calculate([Count], FILTER(Sales,Sales[Sales Type]=Tops[Top4_Type_select]))

 

Table Sales (sample)

NETWORKSHOPSales TypeCount
Net1Shop1Type71
Net1Shop1Type71
Net1Shop1Type51
Net1Shop1Type11
Net1Shop1Type121
Net1Shop1Type71

 

Table Top

NetworkShopTop1Top2Top3Top4
Net1Shop1Type7Type8Type14Type11
Net2Shop10Type13Type4Type12Type9
Net1Shop2Type8Type6Type13Type1

 

 

Matrix target

 TypeShop3NetworkTotal
Top1Type1172123
Top2Type161924
Top3Type1252032
Top4Type941322

 

Thanks in advance to the kind soul that will help me

Regards 

Louis

 

 

1 REPLY 1
v-easonf-msft
Community Support
Community Support

Hi, @TKH8 

The results shown by the 'Matrix target' confuse me even more.

Can you show a sample file to further illustrate your question?

Best Regards,
Community Support Team _ Eason

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors