Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Merhaba Topluluk,
Power BI modelleri ve tabloları farklılık gösterir:
Arazi Tablosu: Ülke adlarını ve ISO kodlarını içerir.
Perakendeci Pazar Veri Tablosu: ISO kodlarını, perakendeci adlarını ve bunların ilgili pazar paylarını içerir (her ülke için toplam 100'dür).
Bu tablolar, ISO Kodu sütununa dayalı bir-çok ilişkisiyle birbirine bağlanmıştır. Bir ülke seçmek için Arazi Tablosundan bir dilimleyici kullanıyorum ve pasta grafiğimin seçilen ülkeye göre verileri görüntülemesini istiyorum.
Başarmak istediğim şey şu:
Pasta grafiği, seçilen ülke için pazar payına göre en iyi 5 perakendeciyi göstermelidir.
"Benim Pazarım" en iyi 5 perakendeci arasında değilse, pastanın 6. dilimi olarak eklenmelidir.
Diğer tüm perakendeciler (en iyi 5 ve Benim Pazarım hariç) bir "Diğerleri" kategorisine gruplandırılmalıdır.
Pasta grafiğindeki tüm dilimlerin toplamı her zaman %100'e eşit olmalıdır.
Lütfen Power BI'da bu işlevi nasıl oluşturacağım konusunda bana rehberlik edebilir misiniz? Özellikle:
Dilimleyici seçimine göre en iyi 5 perakendeciyi nasıl hesaplayıp dinamik olarak görüntüleyebilirim?
En iyi 5'te değilse "Benim Pazarım"ı ek bir kategori olarak nasıl ekleyebilirim?
Kalan perakendecileri bir "Diğerleri" kategorisine nasıl toplayabilirim ve toplamın %100'e normalleştirildiğinden nasıl emin olabilirim?
Bunu başarmak için herhangi bir yardım, rehberlik veya DAX formülü çok takdir edilecektir!
Şimdiden teşekkür ederim!
Solved! Go to Solution.
Hi @emrahkilinc ,
I transled your post, i hope i got everthing.
1- Create a measure to calculate the market share of each retailer for the selected country
Market Share =
SUM('Retailer Market Data Table'[Market Share])
2- Create a measure to dynamically identify the top 5 retailers:
Top 5 Market Share =
IF(
RANKX(
ALL('Retailer Market Data Table'[Retailer]),
[Market Share],
,
DESC
) <= 5,
[Market Share],
BLANK()
)
3-Create a measure to check if "My Market" is among the top 5 retailers:
Is My Market Top 5 =
IF(
SELECTEDVALUE('Retailer Market Data Table'[Retailer]) = "My Market" &&
RANKX(
ALL('Retailer Market Data Table'[Retailer]),
[Market Share],
,
DESC
) <= 5,
1,
0
)
4- Create a measure to group retailers that are neither in the top 5 nor "My Market":
Others Market Share =
IF(
RANKX(
ALL('Retailer Market Data Table'[Retailer]),
[Market Share],
,
DESC
) > 5 &&
SELECTEDVALUE('Retailer Market Data Table'[Retailer]) <> "My Market",
[Market Share],
BLANK()
)
5- Create a measure to ensure all slices in the pie chart add up to 100%:
Normalized Market Share =
VAR Top5 =
CALCULATE(
SUMX(
TOPN(5, ALL('Retailer Market Data Table'[Retailer]), [Market Share], DESC),
[Market Share]
)
)
VAR MyMarket =
CALCULATE(
[Market Share],
'Retailer Market Data Table'[Retailer] = "My Market"
)
VAR Others = 100 - Top5 - MyMarket
RETURN
SWITCH(
TRUE(),
RANKX(
ALL('Retailer Market Data Table'[Retailer]),
[Market Share],
,
DESC
) <= 5, [Market Share],
SELECTEDVALUE('Retailer Market Data Table'[Retailer]) = "My Market", MyMarket,
"Others", Others,
BLANK()
)
Configure it as follows:
Legend: Use the column Retailer to display retailer names or "Others".
Values: Use the measure Normalized Market Share.
Let me know if its all ok.
Thanks for the reply from Bibiano_Geraldo, please allow me to provide another insight.
Hi @emrahkilinc ,
Please refers to the following steps.
The test semantic model is as follows.
Create a category table to store the retailer's categories.
Create the following measure to use as the value for the pie chart.
Measure =
VAR _rank =
RANKX (
ALLSELECTED ( 'Retailer Market Data' ),
CALCULATE ( SUM ( 'Retailer Market Data'[Market Share] ) )
)
RETURN
SWITCH (
SELECTEDVALUE ( 'Category'[Category] ),
"Top 5", IF ( _rank <= 5, SUM ( 'Retailer Market Data'[Market Share] ) ),
"Additional",
IF (_rank > 5 && SELECTEDVALUE ( 'Retailer Market Data'[Retailer] ) = "My Market",
SUM ( 'Retailer Market Data'[Market Share] )
),
"Others",
IF ( _rank > 5 && SELECTEDVALUE ( 'Retailer Market Data'[Retailer] ) <> "My Market",
SUM ( 'Retailer Market Data'[Market Share] )
)
)
Create a pie chart with the Retailer in the Detail field, the Category in the Legend field, and the measure in the Values field. In this way, the pie chart displays the corresponding retailers by category.
Please see the attached pbix for reference.
Best Regards,
Dengliang Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for the reply from Bibiano_Geraldo, please allow me to provide another insight.
Hi @emrahkilinc ,
Please refers to the following steps.
The test semantic model is as follows.
Create a category table to store the retailer's categories.
Create the following measure to use as the value for the pie chart.
Measure =
VAR _rank =
RANKX (
ALLSELECTED ( 'Retailer Market Data' ),
CALCULATE ( SUM ( 'Retailer Market Data'[Market Share] ) )
)
RETURN
SWITCH (
SELECTEDVALUE ( 'Category'[Category] ),
"Top 5", IF ( _rank <= 5, SUM ( 'Retailer Market Data'[Market Share] ) ),
"Additional",
IF (_rank > 5 && SELECTEDVALUE ( 'Retailer Market Data'[Retailer] ) = "My Market",
SUM ( 'Retailer Market Data'[Market Share] )
),
"Others",
IF ( _rank > 5 && SELECTEDVALUE ( 'Retailer Market Data'[Retailer] ) <> "My Market",
SUM ( 'Retailer Market Data'[Market Share] )
)
)
Create a pie chart with the Retailer in the Detail field, the Category in the Legend field, and the measure in the Values field. In this way, the pie chart displays the corresponding retailers by category.
Please see the attached pbix for reference.
Best Regards,
Dengliang Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @emrahkilinc ,
I transled your post, i hope i got everthing.
1- Create a measure to calculate the market share of each retailer for the selected country
Market Share =
SUM('Retailer Market Data Table'[Market Share])
2- Create a measure to dynamically identify the top 5 retailers:
Top 5 Market Share =
IF(
RANKX(
ALL('Retailer Market Data Table'[Retailer]),
[Market Share],
,
DESC
) <= 5,
[Market Share],
BLANK()
)
3-Create a measure to check if "My Market" is among the top 5 retailers:
Is My Market Top 5 =
IF(
SELECTEDVALUE('Retailer Market Data Table'[Retailer]) = "My Market" &&
RANKX(
ALL('Retailer Market Data Table'[Retailer]),
[Market Share],
,
DESC
) <= 5,
1,
0
)
4- Create a measure to group retailers that are neither in the top 5 nor "My Market":
Others Market Share =
IF(
RANKX(
ALL('Retailer Market Data Table'[Retailer]),
[Market Share],
,
DESC
) > 5 &&
SELECTEDVALUE('Retailer Market Data Table'[Retailer]) <> "My Market",
[Market Share],
BLANK()
)
5- Create a measure to ensure all slices in the pie chart add up to 100%:
Normalized Market Share =
VAR Top5 =
CALCULATE(
SUMX(
TOPN(5, ALL('Retailer Market Data Table'[Retailer]), [Market Share], DESC),
[Market Share]
)
)
VAR MyMarket =
CALCULATE(
[Market Share],
'Retailer Market Data Table'[Retailer] = "My Market"
)
VAR Others = 100 - Top5 - MyMarket
RETURN
SWITCH(
TRUE(),
RANKX(
ALL('Retailer Market Data Table'[Retailer]),
[Market Share],
,
DESC
) <= 5, [Market Share],
SELECTEDVALUE('Retailer Market Data Table'[Retailer]) = "My Market", MyMarket,
"Others", Others,
BLANK()
)
Configure it as follows:
Legend: Use the column Retailer to display retailer names or "Others".
Values: Use the measure Normalized Market Share.
Let me know if its all ok.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
81 | |
80 | |
60 | |
35 | |
35 |
User | Count |
---|---|
100 | |
60 | |
56 | |
46 | |
41 |