Enlighten World Flag Slicer in Power BI Desktop

Enlighten World Flag Slicer in Power BI Desktop

Enlighten World Flag Slicer in Power BI Desktop

SQLShack

SQL Server training Español

Enlighten World Flag Slicer in Power BI Desktop

November 21, 2018 by Rajendra Gupta Power BI has a rich set of visuals to represent data according to our requirements. These custom visuals make it easy for us to highlight data effectively to understand and share the data in reports. We have learned many customized visuals so far in ongoing series of Power BI Desktop. In this article, we will explore Enlighten World Flag Slicer visual for Power BI Desktop.

Import Data for Enlighten World Flag Slicer in the Power BI Desktop

Suppose we want to prepare a report to examine the 2018 Asian Games medal table using Power BI Desktop. In the report, Enlighten World Flag Slicer is helpful to visualize the data from the dataset and represent country names with their flags. This represents the country with flags symbol and we can filter out the report for the country just by click on the respective country flag. In this article, we will take data from the Wikipedia 2018 Asian Games medal table. In Power BI Desktop, we can directly fetch data from the web data source and prepare chart from it without exporting data into excel or flat file format. Launch the web data source from Get Data -> Web In the basic option, enter the URL of the web page containing data table and click OK. Preview the data. We can see in the column ‘NOC’ country name are shows along with abbreviations, for example, China (CHN). We need to remove the abbreviation so that we can generate the enlighten world flag slicer. To edit the data, click on ‘Edit’ It opens Power BI editor to make changes in the data. We can split the column to get rid of abbreviations. Click on the ‘Split Column -> By Delimiter’ It automatically selects the delimiter. However, we can select or enter delimiter. We can also choose to split at leftmost/rightmost or split at each occurrence of the delimiter. Proceed next by clicking on ‘OK’. It splits the column based on the delimiter condition specified. We do not need this column, so right click on the column and remove it. Also, rename the column name from ‘NOC’ to ‘Country’. Close and apply to save changes. We can see dataset now to prepare visuals as required. Our sample dataset contains a list of countries, and their medals tally (Gold, bronze or silver). Before we create the enlighten world flag slicer visual, let us create ‘Map’ chart from our data set. Double click on ‘Map’ chart icon as shown and adjust the chart height width in the bottom part of the screen. Now, drag the column fields as below Location -> Country Size -> Total It generates the map chart as shown here. For the countries listed in our data set, it puts a dot to represent the country. In this chart, data is shown for all countries together. We can get the data for Individual County if we hover the mouse over the dots. Now, we will import the ‘Enlighten World Flag Slicer’ visual from the Marketplace. Search it and add as shown below. You can see the icon as a flag shape in the visualization area. Double click on it and adjust the size on the upper side of the blank screen. Click on the ‘Enlighten World Flag Slicer’ and select the ‘Country’ from our dataset. It shows the flag of each country listed in our data set. Now, if we click on any particular country, the map auto zooms to that particular country. For example, here I clicked on ‘China’ and you can see in the chart ‘China’ is zoomed in. Similarly, let us click on another country say ‘Malaysia’ and map chart is again zoomed on that country. If we hover the mouse over the dot representing country, you can see details of medals won by that particular country. For example, below you can find details of ‘Malaysia’ country medals. Now, we will do a little bit of formatting for our enlighten world flag slicer visual. In the format area, click on ‘Title’ and modify the title properties such as font color, background, alignment etc. This will provide a better look for our chart title. As shown above, when we click on any particular country, map redirects to that country. We cannot find the selected country from the flags since it is not highlighted. Therefore, let us add another chart ‘Card’ into the area. Select the chart and click on a country from the dataset. Now, it will show the name of the country we selected from the flags. For example, below it shows Malaysia. Similarly, below it shows county ‘India’ Below we can see Indonesia along with the medals tally for it. We still have one issue with our report. In the above example, you can notice that whichever country we select, it shows ‘First Country’ below the country name. In order to address this, let us create another ‘Measure’ column in the dataset. Right, click on the dataset and select ‘New Measure’. Here, we will use DAX codes to prepare a measured column: CALCULATE: It evaluates an expression in a context that is modified by the specified filters CONCATENATEX: it concatenates the result of an expression evaluated for each row in a table This is interactive to write DAX queries, as soon we write, it guides us with syntax, options. Therefore, the formula for the measured column is as below Measure = CALCULATE(CONCATENATEX(‘2018 Asian Games medal table’,’2018 Asian Games medal table'[Country],”,”)) Rename the column from Measure to ‘SelectedCountry’. Now, map the ‘Selectedcountry’ column in the chart. It shows all countries name if we do not select the country, else only that particular country name is shown. Select any country and we can see that it shows our new column name instead of the first country below the selected country name. Suppose, we want to filter the records based on top 5 countries. We need to make a separate section and display these top 5 countries flags. Adjust the chart size and insert another enlighten world flag slicer as shown here. In the new enlighten chart, map the column ‘Country’. Currently, it is showing all flags in the new enlighten world flag slicer chart. We want to display only the top five countries chart here, so in the ‘Visual level filter’ section, select Top ‘N’. Enter the number of items we want to show. Below this, we can select how to want this filter to apply. For example, in my example, I want to select top countries based on the total number of gold medals. You can see now only top 5 countries flags are displayed. Now, this chart works in two ways. If we click on the country flag, in the top section, the new area also shows that country flag and map redirects to that particular country. Click on the blank area and it removes the filter on the county flag. In another way, click on the flag from the top five country flag, and the top chart shows only that country flag instead of all countries.

Format Enlighten World Flag slicer

Data labels: By default, ‘Data labels’ setting is ‘On’. It shows the country name below the flag. If we change this to ‘Off’, we cannot see the country name: If we change data labels back to ‘On’, we can control the color and the font size for the countries name. By default, data labels show the country name. We can change it to show the value of another field also. For example, in below example, we can see the ‘Gold’ medals count below the flag names. Let us change it back to the country name and look out for the other formatting option. Orientation: By default, orientation is set to horizontal. If we change it to ‘Wrap’ mode, the flag comes closer to each other as shown here. Show Shadow: By default, the shadow section is ‘On’. It shows the border around the flag. If we disable the show shadow, it does not show the border. We should not make this change. As you can see if we remove the border, the country flag looks inappropriate.

Conclusion

The Enlighten World Flag Slicer represents each county with its flag and provides ability to filter out the results for any particular country. You can explore this visual into Power BI Desktop. We will continue the series of exploring customized visuals in Power BI Desktop in future articles.

Table of contents

Power BI Desktop Interactive chord diagrams Power BI Desktop Pulse Charts How to create a Word Cloud generator in Power BI Desktop Power BI desktop Mekko Charts Hexbin Scatterplot in Power BI Desktop Candlestick chart for stock data analysis in Power BI Desktop Enlighten World Flag Slicer in Power BI Desktop Flow Map Chart in Power BI Desktop Ask a Question feature in Power BI Desktop Power BI Desktop Q&A data interaction examples Power BI Desktop and Python; like Peanut Butter and Chocolate Power BI Desktop Pie Chart Tree Importing data from a PDF file in Power BI Desktop Author Recent Posts Rajendra GuptaHi! I am Rajendra Gupta, Database Specialist and Architect, helping organizations implement Microsoft SQL Server, Azure, Couchbase, AWS solutions fast and efficiently, fix related issues, and Performance Tuning with over 14 years of experience.

I am the author of the book "DP-300 Administering Relational Database on Microsoft Azure". I published more than 650 technical articles on MSSQLTips, SQLShack, Quest, CodingSight, and SeveralNines.

I am the creator of one of the biggest free online collections of articles on a single topic, with his 50-part series on SQL Server Always On Availability Groups.

Based on my contribution to the SQL Server community, I have been recognized as the prestigious Best Author of the Year continuously in 2019, 2020, and 2021 (2nd Rank) at SQLShack and the MSSQLTIPS champions award in 2020.

Personal Blog: https://www.dbblogger.com
I am always interested in new challenges so if you need consulting help, reach me at [email protected]

View all posts by Rajendra Gupta Latest posts by Rajendra Gupta (see all) Copy data from AWS RDS SQL Server to Azure SQL Database - October 21, 2022 Rename on-premises SQL Server database and Azure SQL database - October 18, 2022 SQL Commands to check current Date and Time (Timestamp) in SQL Server - October 7, 2022

Related posts

Candlestick chart for stock data analysis in Power BI Desktop Power BI Desktop Pie Chart Tree How to create geographic maps in Power BI using R Report filtering: Excel slicer vs SQL Server Reporting Services (SSRS) parameters Power BI Desktop Pulse Charts 5,433 Views

Follow us

Popular

SQL Convert Date functions and formats SQL Variables: Basics and usage SQL PARTITION BY Clause overview Different ways to SQL delete duplicate rows from a SQL Table How to UPDATE from a SELECT statement in SQL Server SQL Server functions for converting a String to a Date SELECT INTO TEMP TABLE statement in SQL Server SQL WHILE loop with simple examples How to backup and restore MySQL databases using the mysqldump command CASE statement in SQL Overview of SQL RANK functions Understanding the SQL MERGE statement INSERT INTO SELECT statement overview and examples SQL multiple joins for beginners with examples Understanding the SQL Decimal data type DELETE CASCADE and UPDATE CASCADE in SQL Server foreign key SQL Not Equal Operator introduction and examples SQL CROSS JOIN with examples The Table Variable in SQL Server SQL Server table hints – WITH (NOLOCK) best practices

Trending

SQL Server Transaction Log Backup, Truncate and Shrink Operations Six different methods to copy tables between databases in SQL Server How to implement error handling in SQL Server Working with the SQL Server command line (sqlcmd) Methods to avoid the SQL divide by zero error Query optimization techniques in SQL Server: tips and tricks How to create and configure a linked server in SQL Server Management Studio SQL replace: How to replace ASCII special characters in SQL Server How to identify slow running queries in SQL Server SQL varchar data type deep dive How to implement array-like functionality in SQL Server All about locking in SQL Server SQL Server stored procedures for beginners Database table partitioning in SQL Server How to drop temp tables in SQL Server How to determine free space and file size for SQL Server databases Using PowerShell to split a string into an array KILL SPID command in SQL Server How to install SQL Server Express edition SQL Union overview, usage and examples

Solutions

Read a SQL Server transaction logSQL Server database auditing techniquesHow to recover SQL Server data from accidental UPDATE and DELETE operationsHow to quickly search for SQL database data and objectsSynchronize SQL Server databases in different remote sourcesRecover SQL data from a dropped table without backupsHow to restore specific table(s) from a SQL Server database backupRecover deleted SQL data from transaction logsHow to recover SQL Server data from accidental updates without backupsAutomatically compare and synchronize SQL Server dataOpen LDF file and view LDF file contentQuickly convert SQL code to language-specific client codeHow to recover a single table from a SQL Server database backupRecover data lost due to a TRUNCATE operation without backupsHow to recover SQL Server data from accidental DELETE, TRUNCATE and DROP operationsReverting your SQL Server database back to a specific point in timeHow to create SSIS package documentationMigrate a SQL Server database to a newer version of SQL ServerHow to restore a SQL Server database backup to an older version of SQL Server

Categories and tips

►Auditing and compliance (50) Auditing (40) Data classification (1) Data masking (9) Azure (295) Azure Data Studio (46) Backup and restore (108) ▼Business Intelligence (482) Analysis Services (SSAS) (47) Biml (10) Data Mining (14) Data Quality Services (4) Data Tools (SSDT) (13) Data Warehouse (16) Excel (20) General (39) Integration Services (SSIS) (125) Master Data Services (6) OLAP cube (15) PowerBI (95) Reporting Services (SSRS) (67) Data science (21) ►Database design (233) Clustering (16) Common Table Expressions (CTE) (11) Concurrency (1) Constraints (8) Data types (11) FILESTREAM (22) General database design (104) Partitioning (13) Relationships and dependencies (12) Temporal tables (12) Views (16) ►Database development (418) Comparison (4) Continuous delivery (CD) (5) Continuous integration (CI) (11) Development (146) Functions (106) Hyper-V (1) Search (10) Source Control (15) SQL unit testing (23) Stored procedures (34) String Concatenation (2) Synonyms (1) Team Explorer (2) Testing (35) Visual Studio (14) DBAtools (35) DevOps (23) DevSecOps (2) Documentation (22) ETL (76) ►Features (213) Adaptive query processing (11) Bulk insert (16) Database mail (10) DBCC (7) Experimentation Assistant (DEA) (3) High Availability (36) Query store (10) Replication (40) Transaction log (59) Transparent Data Encryption (TDE) (21) Importing, exporting (51) Installation, setup and configuration (121) Jobs (42) ►Languages and coding (686) Cursors (9) DDL (9) DML (6) JSON (17) PowerShell (77) Python (37) R (16) SQL commands (196) SQLCMD (7) String functions (21) T-SQL (275) XML (15) Lists (12) Machine learning (37) Maintenance (99) Migration (50) Miscellaneous (1) ►Performance tuning (869) Alerting (8) Always On Availability Groups (82) Buffer Pool Extension (BPE) (9) Columnstore index (9) Deadlocks (16) Execution plans (125) In-Memory OLTP (22) Indexes (79) Latches (5) Locking (10) Monitoring (100) Performance (196) Performance counters (28) Performance Testing (9) Query analysis (121) Reports (20) SSAS monitoring (3) SSIS monitoring (10) SSRS monitoring (4) Wait types (11) ►Professional development (68) Professional development (27) Project management (9) SQL interview questions (32) Recovery (33) Security (84) Server management (24) SQL Azure (271) SQL Server Management Studio (SSMS) (90) SQL Server on Linux (21) ►SQL Server versions (177) SQL Server 2012 (6) SQL Server 2016 (63) SQL Server 2017 (49) SQL Server 2019 (57) SQL Server 2022 (2) ►Technologies (334) AWS (45) AWS RDS (56) Azure Cosmos DB (28) Containers (12) Docker (9) Graph database (13) Kerberos (2) Kubernetes (1) Linux (44) LocalDB (2) MySQL (49) Oracle (10) PolyBase (10) PostgreSQL (36) SharePoint (4) Ubuntu (13) Uncategorized (4) Utilities (21) Helpers and best practices BI performance counters SQL code smells rules SQL Server wait types © 2022 Quest Software Inc. ALL RIGHTS RESERVED. GDPR Terms of Use Privacy
Share:
0 comments

Comments (0)

Leave a Comment

Minimum 10 characters required

* All fields are required. Comments are moderated before appearing.

No comments yet. Be the first to comment!

Enlighten World Flag Slicer in Power BI Desktop | Trend Now | Trend Now