SlideShare a Scribd company logo
Power BI Tips
and Timesavers
Advanced TOP N in
Power BI
We showed how the standard filters in Power BI could be used to filter
the top or bottom rows
But, what if you also need to show the ‘others’ at the same time
This is a little more in depth, this guide shows you how
Advanced Top N
If you use the standard
TOP 5 filter, you ONLY
see the top 5
We will show you how
to add a slicer to select
which top rows to see
And also how to show
the balance as an
‘Others’ row
Step 1
Ensure there is a
measure value for the
ranking
You may have a
measure already, but if
not create one
DAX Code
Gross Sales New =
SUM(Financials[Gross Sales])
Step 2
Create a new table to determine the values for
‘Other’
Use this DAX code to create the new table
TopN Names =
UNION
(ALLNOBLANKROW( Financials[Country]),
{"Others"}
)
Step 3
Create a parameter to set the number of top
rows to show
ensure the parameter details are set as this
This creates a new parameter table and a slicer at the same time
Step 4
Add a new measure
This applies a ranking to all values in the rows,
including others, based on the measure.
Ranking =
VAR CatToRank = [TopN Value]
VAR Ranking =
RANKX (
ALLSELECTED('TopN Names'[Country]),
[Gross Sales New]
)
VAR IsOtherSelected =
SELECTEDVALUE('TopN Names'[Country]) = "Others"
VAR Result =
IF (
IsOtherSelected,
CatToRank + 1,
IF ( Ranking <= CatToRank , Ranking, ranking + 1)
)
Return
Result
Step 5
Make the rows visible if their rank is within the
Top N results
Create another measure with this code
RowVisible =
VAR Ranking = [Ranking]
VAR TopNValue = 'TopN'[TopN Value]
VAR Result = INT( Ranking <= TopNValue + 1)
Return
Result
Step 6
Compute a value for 'Others'
Gross Sales New Amount =
VAR NewMeasureAll =
CALCULATE( [Gross Sales New], REMOVEFILTERS('TopN Names'[Country]) )
RETURN
IF (
ISINSCOPE('TopN Names'[Country] ),
VAR TopNToRank = [TopN Value]
VAR IsOtherSelected = SELECTEDVALUE('TopN Names'[Country]) = "Others"
VAR TopNWithMeasure =
ADDCOLUMNS(
ALLSELECTED('TopN Names'[Country]),
"@amt" , [Gross Sales New]
)
VAR TopNCat = TOPN( TopNToRank, TopNWithMeasure, [@amt] )
VAR TotalTopN = SUMX( TopNCat,[@amt] )
VAR Result = IF ( IsOtherSelected, NewMeasureAll - TotalTopN , [Gross Sales New])
RETURN Result ,
NewMeasureAll
)
This creates a new measure which is used in place of the original. This is necessary as the total of “Other” results has to be recalculated when the
TopN value changes.
Create the relationship to the Top N
Enable “Other” values by Joining TopN
Names table to the Financials table.
Open the Model window using the
bottom icon in the left menu
Create a connection (Join) between the two Country objects
Filter to show Top N and Other
As it stands the Matrix is showing the original values, and all values.
The Row Visible measure can be used to filter as only TopN and
Other
Ensure the Matrix is selected.
Drag Row Visible item from Fields Pane to the Add Data field in the
Filter Pane
Change the Show Items drop down to ‘IS’
Add ‘1’ to the value box
Click Apply Filter
Include the new values in the matrix
Swap Gross Sales New
measure for the Gross Sales
New Amount in the
Visualisations Pane, Values
box
This changes the values in
the Matrix. Note ‘Other’ is
now shown.
By default this is sorting the values by country ascending, we want the
values to sort descending, but with the 'others' to always be last
We add the 'Ranking' measure into the matrix
Order the Ranking values Ascending. Click on the column header in the
matrix until the Arrow points up and the ranking is from 1 upwards.
Use in other visuals
Change the visual type to Pie
Chart.
This example clearly shows
the top 5 as representing
around a quarter of the
whole, with 'Others' showing
the majority
In this case we do not need
Ranking, it can be removed
See it in action
Users can use the slicer to alter the level of detail they need to see
This is a little more complicated than the normal Top N filter, but the
overall effect is worth the effort
Having the option to select the Top N value using a slicer in Power BI is a
great way to allow the user to interact with the data
For more Tips, Tricks and
Timesavers, visit our website
Business Analytics Blog – Select Distinct
Credit: simon.harrison@selectdistinct.co.uk

More Related Content

Similar to Advanced Top N Measures in Power BI

Exp2003 exl ppt_04
Exp2003 exl ppt_04Exp2003 exl ppt_04
Exp2003 exl ppt_04
lonetree
 
6 Excel Essentials for Digital Marketers
6 Excel Essentials for Digital Marketers6 Excel Essentials for Digital Marketers
6 Excel Essentials for Digital Marketers
Happy Marketer
 
3 Excel Tools That Help You Perform a What-If Analysis
3 Excel Tools That Help You Perform a What-If Analysis3 Excel Tools That Help You Perform a What-If Analysis
3 Excel Tools That Help You Perform a What-If Analysis
Hanapin Marketing
 
Create a PivotTable to analyze worksheet data.pdf
Create a PivotTable to analyze worksheet data.pdfCreate a PivotTable to analyze worksheet data.pdf
Create a PivotTable to analyze worksheet data.pdf
Abubakar Bashir
 
Lesson 18 Creating Pivot Tables
Lesson 18 Creating Pivot TablesLesson 18 Creating Pivot Tables
Lesson 18 Creating Pivot Tablesguevarra_2000
 
4b6c1c5c-e913-4bbf-b3a4-41e23cb961ba-161004200047.pdf
4b6c1c5c-e913-4bbf-b3a4-41e23cb961ba-161004200047.pdf4b6c1c5c-e913-4bbf-b3a4-41e23cb961ba-161004200047.pdf
4b6c1c5c-e913-4bbf-b3a4-41e23cb961ba-161004200047.pdf
Nitish Nagar
 
I Simply Excel
I Simply ExcelI Simply Excel
I Simply Excel
Eric Couch
 
1a s4 i creating runcharts final
1a s4 i creating runcharts final1a s4 i creating runcharts final
1a s4 i creating runcharts final
ABCiABUHB
 
GC TUG Spring 2024 - Dashboard Actions.pptx
GC TUG Spring 2024 - Dashboard Actions.pptxGC TUG Spring 2024 - Dashboard Actions.pptx
GC TUG Spring 2024 - Dashboard Actions.pptx
Russ Cantrell
 
Day 4 more on formulas and functions
Day 4 more on formulas and functionsDay 4 more on formulas and functions
Day 4 more on formulas and functions
Joyce Effinger
 
Power BI Tips Switch Measures.pptx
Power BI Tips Switch Measures.pptxPower BI Tips Switch Measures.pptx
Power BI Tips Switch Measures.pptx
Select Distinct Limited
 
Dax queries.pdf
Dax queries.pdfDax queries.pdf
Dax queries.pdf
ntrnbk
 
Microsoft Excel VLOOKUP Function
Microsoft Excel VLOOKUP FunctionMicrosoft Excel VLOOKUP Function
Microsoft Excel VLOOKUP Function
Excel
 
Seven Quality Tools.pptx
Seven Quality Tools.pptxSeven Quality Tools.pptx
Seven Quality Tools.pptx
Vijayarani Kasinadar
 
Quality_Tools1.ppt
Quality_Tools1.pptQuality_Tools1.ppt
Quality_Tools1.ppt
Prashant Tiwari
 
Commonly used excel formulas
Commonly used excel formulasCommonly used excel formulas
Commonly used excel formulas
saladi330
 
Commonly used excel formulas
Commonly used excel formulasCommonly used excel formulas
Commonly used excel formulas
saladi330
 
Industry analysis tool 2.0
Industry analysis tool 2.0Industry analysis tool 2.0
Industry analysis tool 2.0
Joseph Cardoni
 

Similar to Advanced Top N Measures in Power BI (20)

Exp2003 exl ppt_04
Exp2003 exl ppt_04Exp2003 exl ppt_04
Exp2003 exl ppt_04
 
6 Excel Essentials for Digital Marketers
6 Excel Essentials for Digital Marketers6 Excel Essentials for Digital Marketers
6 Excel Essentials for Digital Marketers
 
3 Excel Tools That Help You Perform a What-If Analysis
3 Excel Tools That Help You Perform a What-If Analysis3 Excel Tools That Help You Perform a What-If Analysis
3 Excel Tools That Help You Perform a What-If Analysis
 
Create a PivotTable to analyze worksheet data.pdf
Create a PivotTable to analyze worksheet data.pdfCreate a PivotTable to analyze worksheet data.pdf
Create a PivotTable to analyze worksheet data.pdf
 
Lesson 18 Creating Pivot Tables
Lesson 18 Creating Pivot TablesLesson 18 Creating Pivot Tables
Lesson 18 Creating Pivot Tables
 
4b6c1c5c-e913-4bbf-b3a4-41e23cb961ba-161004200047.pdf
4b6c1c5c-e913-4bbf-b3a4-41e23cb961ba-161004200047.pdf4b6c1c5c-e913-4bbf-b3a4-41e23cb961ba-161004200047.pdf
4b6c1c5c-e913-4bbf-b3a4-41e23cb961ba-161004200047.pdf
 
I Simply Excel
I Simply ExcelI Simply Excel
I Simply Excel
 
Advanced Excel ppt
Advanced Excel pptAdvanced Excel ppt
Advanced Excel ppt
 
1a s4 i creating runcharts final
1a s4 i creating runcharts final1a s4 i creating runcharts final
1a s4 i creating runcharts final
 
GC TUG Spring 2024 - Dashboard Actions.pptx
GC TUG Spring 2024 - Dashboard Actions.pptxGC TUG Spring 2024 - Dashboard Actions.pptx
GC TUG Spring 2024 - Dashboard Actions.pptx
 
Day 4 more on formulas and functions
Day 4 more on formulas and functionsDay 4 more on formulas and functions
Day 4 more on formulas and functions
 
Power BI Tips Switch Measures.pptx
Power BI Tips Switch Measures.pptxPower BI Tips Switch Measures.pptx
Power BI Tips Switch Measures.pptx
 
Dax queries.pdf
Dax queries.pdfDax queries.pdf
Dax queries.pdf
 
Microsoft Excel VLOOKUP Function
Microsoft Excel VLOOKUP FunctionMicrosoft Excel VLOOKUP Function
Microsoft Excel VLOOKUP Function
 
Seven Quality Tools.pptx
Seven Quality Tools.pptxSeven Quality Tools.pptx
Seven Quality Tools.pptx
 
Quality_Tools1.ppt
Quality_Tools1.pptQuality_Tools1.ppt
Quality_Tools1.ppt
 
Commonly used excel formulas
Commonly used excel formulasCommonly used excel formulas
Commonly used excel formulas
 
Commonly used excel formulas
Commonly used excel formulasCommonly used excel formulas
Commonly used excel formulas
 
Industry analysis tool 2.0
Industry analysis tool 2.0Industry analysis tool 2.0
Industry analysis tool 2.0
 
Chap 4 c++
Chap 4 c++Chap 4 c++
Chap 4 c++
 

More from Select Distinct Limited

Year on Year Comparison in Power BI.pptx
Year on Year Comparison in Power BI.pptxYear on Year Comparison in Power BI.pptx
Year on Year Comparison in Power BI.pptx
Select Distinct Limited
 
Sync Slicers in Power BI a step by step guide
Sync Slicers in Power BI a step by step guideSync Slicers in Power BI a step by step guide
Sync Slicers in Power BI a step by step guide
Select Distinct Limited
 
Using Google Search Console Data in Power BI.pptx
Using Google Search Console Data in Power BI.pptxUsing Google Search Console Data in Power BI.pptx
Using Google Search Console Data in Power BI.pptx
Select Distinct Limited
 
Data Lake v Data Warehouse. What is the difference?
Data Lake v Data Warehouse. What is the difference?Data Lake v Data Warehouse. What is the difference?
Data Lake v Data Warehouse. What is the difference?
Select Distinct Limited
 
How to Create Drop Down Lists in Excel, step by step
How to Create Drop Down Lists in Excel, step by stepHow to Create Drop Down Lists in Excel, step by step
How to Create Drop Down Lists in Excel, step by step
Select Distinct Limited
 
Top 5 SQL Tips and Timesaver 2023, our most popular posts
Top 5 SQL Tips and Timesaver 2023, our most popular postsTop 5 SQL Tips and Timesaver 2023, our most popular posts
Top 5 SQL Tips and Timesaver 2023, our most popular posts
Select Distinct Limited
 
Top 5 Power BI tips 2023 most popular blog posts
Top 5 Power BI tips 2023 most popular blog postsTop 5 Power BI tips 2023 most popular blog posts
Top 5 Power BI tips 2023 most popular blog posts
Select Distinct Limited
 
CTEs in SQL.pptx
CTEs in SQL.pptxCTEs in SQL.pptx
CTEs in SQL.pptx
Select Distinct Limited
 
Divide by Zero Errors
Divide by Zero ErrorsDivide by Zero Errors
Divide by Zero Errors
Select Distinct Limited
 
When to transform data for Power BI.pptx
When to transform data for Power BI.pptxWhen to transform data for Power BI.pptx
When to transform data for Power BI.pptx
Select Distinct Limited
 
Power BI KPIs
Power BI KPIsPower BI KPIs
Direction of travel on a map in Power BI.pptx
Direction of travel on a map in Power BI.pptxDirection of travel on a map in Power BI.pptx
Direction of travel on a map in Power BI.pptx
Select Distinct Limited
 
UNION in DAX
UNION in DAXUNION in DAX
APPEND data in Power Query
APPEND data in Power QueryAPPEND data in Power Query
APPEND data in Power Query
Select Distinct Limited
 
Power BI Connect to Google BigQuery.pptx
Power BI Connect to Google BigQuery.pptxPower BI Connect to Google BigQuery.pptx
Power BI Connect to Google BigQuery.pptx
Select Distinct Limited
 
Group by ROLLUP in SQL Server
Group by ROLLUP in SQL ServerGroup by ROLLUP in SQL Server
Group by ROLLUP in SQL Server
Select Distinct Limited
 
Custom Formats in Power BI
Custom Formats in Power BICustom Formats in Power BI
Custom Formats in Power BI
Select Distinct Limited
 
SQL Tips UNPIVOT Function.pptx
SQL Tips UNPIVOT Function.pptxSQL Tips UNPIVOT Function.pptx
SQL Tips UNPIVOT Function.pptx
Select Distinct Limited
 
Power BI Drill Through
Power BI Drill ThroughPower BI Drill Through
Power BI Drill Through
Select Distinct Limited
 
How to PIVOT in SQL
How to PIVOT in SQLHow to PIVOT in SQL
How to PIVOT in SQL
Select Distinct Limited
 

More from Select Distinct Limited (20)

Year on Year Comparison in Power BI.pptx
Year on Year Comparison in Power BI.pptxYear on Year Comparison in Power BI.pptx
Year on Year Comparison in Power BI.pptx
 
Sync Slicers in Power BI a step by step guide
Sync Slicers in Power BI a step by step guideSync Slicers in Power BI a step by step guide
Sync Slicers in Power BI a step by step guide
 
Using Google Search Console Data in Power BI.pptx
Using Google Search Console Data in Power BI.pptxUsing Google Search Console Data in Power BI.pptx
Using Google Search Console Data in Power BI.pptx
 
Data Lake v Data Warehouse. What is the difference?
Data Lake v Data Warehouse. What is the difference?Data Lake v Data Warehouse. What is the difference?
Data Lake v Data Warehouse. What is the difference?
 
How to Create Drop Down Lists in Excel, step by step
How to Create Drop Down Lists in Excel, step by stepHow to Create Drop Down Lists in Excel, step by step
How to Create Drop Down Lists in Excel, step by step
 
Top 5 SQL Tips and Timesaver 2023, our most popular posts
Top 5 SQL Tips and Timesaver 2023, our most popular postsTop 5 SQL Tips and Timesaver 2023, our most popular posts
Top 5 SQL Tips and Timesaver 2023, our most popular posts
 
Top 5 Power BI tips 2023 most popular blog posts
Top 5 Power BI tips 2023 most popular blog postsTop 5 Power BI tips 2023 most popular blog posts
Top 5 Power BI tips 2023 most popular blog posts
 
CTEs in SQL.pptx
CTEs in SQL.pptxCTEs in SQL.pptx
CTEs in SQL.pptx
 
Divide by Zero Errors
Divide by Zero ErrorsDivide by Zero Errors
Divide by Zero Errors
 
When to transform data for Power BI.pptx
When to transform data for Power BI.pptxWhen to transform data for Power BI.pptx
When to transform data for Power BI.pptx
 
Power BI KPIs
Power BI KPIsPower BI KPIs
Power BI KPIs
 
Direction of travel on a map in Power BI.pptx
Direction of travel on a map in Power BI.pptxDirection of travel on a map in Power BI.pptx
Direction of travel on a map in Power BI.pptx
 
UNION in DAX
UNION in DAXUNION in DAX
UNION in DAX
 
APPEND data in Power Query
APPEND data in Power QueryAPPEND data in Power Query
APPEND data in Power Query
 
Power BI Connect to Google BigQuery.pptx
Power BI Connect to Google BigQuery.pptxPower BI Connect to Google BigQuery.pptx
Power BI Connect to Google BigQuery.pptx
 
Group by ROLLUP in SQL Server
Group by ROLLUP in SQL ServerGroup by ROLLUP in SQL Server
Group by ROLLUP in SQL Server
 
Custom Formats in Power BI
Custom Formats in Power BICustom Formats in Power BI
Custom Formats in Power BI
 
SQL Tips UNPIVOT Function.pptx
SQL Tips UNPIVOT Function.pptxSQL Tips UNPIVOT Function.pptx
SQL Tips UNPIVOT Function.pptx
 
Power BI Drill Through
Power BI Drill ThroughPower BI Drill Through
Power BI Drill Through
 
How to PIVOT in SQL
How to PIVOT in SQLHow to PIVOT in SQL
How to PIVOT in SQL
 

Recently uploaded

Jpolillo Amazon PPC - Bid Optimization Sample
Jpolillo Amazon PPC - Bid Optimization SampleJpolillo Amazon PPC - Bid Optimization Sample
Jpolillo Amazon PPC - Bid Optimization Sample
James Polillo
 
Q1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year ReboundQ1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year Rebound
Oppotus
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
ewymefz
 
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
axoqas
 
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
yhkoc
 
The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...
jerlynmaetalle
 
Innovative Methods in Media and Communication Research by Sebastian Kubitschk...
Innovative Methods in Media and Communication Research by Sebastian Kubitschk...Innovative Methods in Media and Communication Research by Sebastian Kubitschk...
Innovative Methods in Media and Communication Research by Sebastian Kubitschk...
correoyaya
 
一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单
enxupq
 
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
John Andrews
 
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdfCh03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
haila53
 
一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单
ocavb
 
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
vcaxypu
 
社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .
NABLAS株式会社
 
Investigate & Recover / StarCompliance.io / Crypto_Crimes
Investigate & Recover / StarCompliance.io / Crypto_CrimesInvestigate & Recover / StarCompliance.io / Crypto_Crimes
Investigate & Recover / StarCompliance.io / Crypto_Crimes
StarCompliance.io
 
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
nscud
 
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
ukgaet
 
一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单
enxupq
 
FP Growth Algorithm and its Applications
FP Growth Algorithm and its ApplicationsFP Growth Algorithm and its Applications
FP Growth Algorithm and its Applications
MaleehaSheikh2
 
Tabula.io Cheatsheet: automate your data workflows
Tabula.io Cheatsheet: automate your data workflowsTabula.io Cheatsheet: automate your data workflows
Tabula.io Cheatsheet: automate your data workflows
alex933524
 
一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单
ewymefz
 

Recently uploaded (20)

Jpolillo Amazon PPC - Bid Optimization Sample
Jpolillo Amazon PPC - Bid Optimization SampleJpolillo Amazon PPC - Bid Optimization Sample
Jpolillo Amazon PPC - Bid Optimization Sample
 
Q1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year ReboundQ1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year Rebound
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
 
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
 
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
 
The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...
 
Innovative Methods in Media and Communication Research by Sebastian Kubitschk...
Innovative Methods in Media and Communication Research by Sebastian Kubitschk...Innovative Methods in Media and Communication Research by Sebastian Kubitschk...
Innovative Methods in Media and Communication Research by Sebastian Kubitschk...
 
一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单
 
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
 
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdfCh03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
 
一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单
 
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
 
社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .
 
Investigate & Recover / StarCompliance.io / Crypto_Crimes
Investigate & Recover / StarCompliance.io / Crypto_CrimesInvestigate & Recover / StarCompliance.io / Crypto_Crimes
Investigate & Recover / StarCompliance.io / Crypto_Crimes
 
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
 
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
 
一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单
 
FP Growth Algorithm and its Applications
FP Growth Algorithm and its ApplicationsFP Growth Algorithm and its Applications
FP Growth Algorithm and its Applications
 
Tabula.io Cheatsheet: automate your data workflows
Tabula.io Cheatsheet: automate your data workflowsTabula.io Cheatsheet: automate your data workflows
Tabula.io Cheatsheet: automate your data workflows
 
一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单
 

Advanced Top N Measures in Power BI

  • 1. Power BI Tips and Timesavers Advanced TOP N in Power BI
  • 2. We showed how the standard filters in Power BI could be used to filter the top or bottom rows But, what if you also need to show the ‘others’ at the same time This is a little more in depth, this guide shows you how
  • 3. Advanced Top N If you use the standard TOP 5 filter, you ONLY see the top 5 We will show you how to add a slicer to select which top rows to see And also how to show the balance as an ‘Others’ row
  • 4. Step 1 Ensure there is a measure value for the ranking You may have a measure already, but if not create one DAX Code Gross Sales New = SUM(Financials[Gross Sales])
  • 5. Step 2 Create a new table to determine the values for ‘Other’ Use this DAX code to create the new table TopN Names = UNION (ALLNOBLANKROW( Financials[Country]), {"Others"} )
  • 6. Step 3 Create a parameter to set the number of top rows to show ensure the parameter details are set as this This creates a new parameter table and a slicer at the same time
  • 7. Step 4 Add a new measure This applies a ranking to all values in the rows, including others, based on the measure. Ranking = VAR CatToRank = [TopN Value] VAR Ranking = RANKX ( ALLSELECTED('TopN Names'[Country]), [Gross Sales New] ) VAR IsOtherSelected = SELECTEDVALUE('TopN Names'[Country]) = "Others" VAR Result = IF ( IsOtherSelected, CatToRank + 1, IF ( Ranking <= CatToRank , Ranking, ranking + 1) ) Return Result
  • 8. Step 5 Make the rows visible if their rank is within the Top N results Create another measure with this code RowVisible = VAR Ranking = [Ranking] VAR TopNValue = 'TopN'[TopN Value] VAR Result = INT( Ranking <= TopNValue + 1) Return Result
  • 9. Step 6 Compute a value for 'Others' Gross Sales New Amount = VAR NewMeasureAll = CALCULATE( [Gross Sales New], REMOVEFILTERS('TopN Names'[Country]) ) RETURN IF ( ISINSCOPE('TopN Names'[Country] ), VAR TopNToRank = [TopN Value] VAR IsOtherSelected = SELECTEDVALUE('TopN Names'[Country]) = "Others" VAR TopNWithMeasure = ADDCOLUMNS( ALLSELECTED('TopN Names'[Country]), "@amt" , [Gross Sales New] ) VAR TopNCat = TOPN( TopNToRank, TopNWithMeasure, [@amt] ) VAR TotalTopN = SUMX( TopNCat,[@amt] ) VAR Result = IF ( IsOtherSelected, NewMeasureAll - TotalTopN , [Gross Sales New]) RETURN Result , NewMeasureAll ) This creates a new measure which is used in place of the original. This is necessary as the total of “Other” results has to be recalculated when the TopN value changes.
  • 10. Create the relationship to the Top N Enable “Other” values by Joining TopN Names table to the Financials table. Open the Model window using the bottom icon in the left menu Create a connection (Join) between the two Country objects
  • 11. Filter to show Top N and Other As it stands the Matrix is showing the original values, and all values. The Row Visible measure can be used to filter as only TopN and Other Ensure the Matrix is selected. Drag Row Visible item from Fields Pane to the Add Data field in the Filter Pane Change the Show Items drop down to ‘IS’ Add ‘1’ to the value box Click Apply Filter
  • 12. Include the new values in the matrix Swap Gross Sales New measure for the Gross Sales New Amount in the Visualisations Pane, Values box This changes the values in the Matrix. Note ‘Other’ is now shown. By default this is sorting the values by country ascending, we want the values to sort descending, but with the 'others' to always be last We add the 'Ranking' measure into the matrix Order the Ranking values Ascending. Click on the column header in the matrix until the Arrow points up and the ranking is from 1 upwards.
  • 13. Use in other visuals Change the visual type to Pie Chart. This example clearly shows the top 5 as representing around a quarter of the whole, with 'Others' showing the majority In this case we do not need Ranking, it can be removed
  • 14. See it in action Users can use the slicer to alter the level of detail they need to see
  • 15. This is a little more complicated than the normal Top N filter, but the overall effect is worth the effort Having the option to select the Top N value using a slicer in Power BI is a great way to allow the user to interact with the data
  • 16. For more Tips, Tricks and Timesavers, visit our website Business Analytics Blog – Select Distinct Credit: simon.harrison@selectdistinct.co.uk