avatarShashanka Shekhar

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

3175

Abstract

5">The table presents sales data for office supplies in Los Angeles, California, categorized under various columns. Here’s a detailed breakdown:</p><h2 id="8075">Columns in the Table:</h2><ul><li><b>City</b>: This column indicates the city where the sales transactions took place.</li><li><b>State/Province</b>: This column shows the state or province associated with each transaction.</li><li><b>Region</b>: This column categorizes the transactions into broader regions, such as West, East, etc.</li><li><b>Category</b>: This column specifies the type of products being sold, like Office Supplies, Furniture, etc.</li><li><b>Sales</b>: This column provides the monetary value of the sales for each transaction.</li><li><b>Quantity</b>: This column records the number of units sold in each transaction.</li></ul><h1 id="b8c7">General Observations of the Data:</h1><ol><li><b>Variety in Location</b>: The transactions occur in multiple cities and states, not just Los Angeles, California. This indicates a broader geographical spread.</li><li><b>Range of Categories</b>: The data covers multiple product categories such as Office Supplies, Furniture, Technology, etc., showcasing a variety of business segments.</li><li><b>Sales Figures</b>: The sales amounts vary significantly, reflecting different transaction sizes and potentially diverse customer bases.</li><li><b>Quantity Sold</b>: There is a wide range in the number of units sold per transaction, suggesting varying customer demands and order sizes.</li><li><b>Temporal Diversity</b>: The data spans multiple time periods, which may indicate seasonal trends or changes in sales patterns over time.</li></ol><p id="8e24">The table helps in analyzing the sales performance of office supplies in a specific region, which can be useful for inventory management, financial planning, and market analysis.</p><h2 id="40cb">2. Opening Power Query:</h2><ul><li>In the<b> Home tab</b> press on the<b> Transform Data in the Queries section.</b></li><li>It will open the <b>Power Query</b> window.</li></ul><figure id="7700"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*0KIpAxXbCeUMwJ0brrsDQg.gif"><figcaption>In the Home tab press on the Transform Data in the Queries section</figcaption></figure><h2 id="a2c5">3. Sorting the first three columns:</h2><ul><li>Press on the <b>City column</b> and select <b>Sort Ascending.</b></li><li>Now repeat the same process for <b>State/Province</b> and <b>Region</b> columns.</li></ul><figure id="a269"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*v68oS8JUvM82KWlXfXCSaA.gif"><figcaption>Press on the City column and select Sort Ascending</figcaption></figure><h2 id="4c43">4. Sorting the Final three columns:</h2><ul><li>Press on the <b>Category column</b> and select <b>Sort Descending.</b></li><li>Now repeat the same process for <b>Sales</b> and <b>Quantity</b> columns.</li></ul><figure id="44bd"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*Y0e3B5IMeAxazBT-x0onXQ.gif"><figcaption>Press on the Category column and select Sort Descending</figcaption></figure><h2 id="79ff">5. Checking the M Query:</h2><ul><li>In the <b>AP

Options

PLIED STEPS</b>, you will find a <b>Sorted Rows</b> step being added.</li><li>Click on it and you will find the <b>M Query</b> for the sorting.</li></ul><figure id="2c0b"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*Y0e3B5IMeAxazBT-x0onXQ.gif"><figcaption>In the APPLIED STEPS, you will find a Sorted Rows step being added</figcaption></figure><p id="fc10">You fill find this Query in the function bar section.</p><blockquote id="9a49"><p><b>= Table.Sort(#”Removed Other Columns”,{{“City”, Order.Ascending}, {“State/Province”, Order.Ascending}, {“Region”, Order.Ascending}, {“Category”, Order.Descending}, {“Sales”, Order.Descending}, {“Quantity”, Order.Descending}})</b></p></blockquote><p id="dc16" type="7">Download the Data for the above comparison from this link.</p><div id="52d7" class="link-block"> <a href="https://readmedium.com/crafting-an-interactive-ytd-sales-kpi-in-power-bi-93690b727cc2"> <div> <div> <h2>Crafting an Interactive YTD Sales KPI in Power BI</h2> <div><h3>Creating a Year-to-Date (YTD) Sales KPI in Power BI can significantly enhance your data analysis and reporting…</h3></div> <div><p>medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*Izlr46HJOno7QUhuDU4fdw.jpeg)"></div> </div> </div> </a> </div><p id="1cb3">Thank you for your attention!</p><p id="e1fc"><a href="https://medium.com/@shashanka.shekhar02">Follow</a> me or <a href="https://medium.com/@shashanka.shekhar02/subscribe">subscribe </a>to get all my Power BI articles!</p><div id="7158" class="link-block"> <a href="https://medium.com/@shashanka.shekhar02"> <div> <div> <h2>Shashanka Shekhar - Medium</h2> <div><h3>Read writing from Shashanka Shekhar on Medium. Contributor for Microsoft Power BI. I like Data Analysis and Data…</h3></div> <div><p>medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*59mSc5-xTe2L6wHd)"></div> </div> </div> </a> </div><p id="4636" type="7">Don’t forget to subscribe to</p><p id="2689" type="7">👉 Power BI Publication</p><p id="d808" type="7">👉 Power BI Newsletter</p><p id="aa59" type="7">and join our Power BI community:</p><div id="4f69" class="link-block"> <a href="https://linktr.ee/powerbi.masterclass"> <div> <div> <h2>Microsoft Power BI Masterclass | Twitter, Instagram | Linktree</h2> <div><h3>Let’s share our Microsoft Power BI experience. Learn together. Grow together.</h3></div> <div><p>linktr.ee</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*9Eg9CiCogmIHDYAn)"></div> </div> </div> </a> </div></article></body>

Sorting Multiple Columns using Power Query in Power BI

Sorting Multiple Columns Using Power Query in Power BI

Sorting data is a fundamental aspect of data analysis that helps in organizing and understanding information effectively. Power Query in Power BI provides robust tools for sorting multiple columns, making the data analysis process more efficient and accurate. This article will guide you through the steps required to sort multiple columns using Power Query in Power BI, ensuring that you can present your data in the most logical and meaningful order.

Key Benefits of Sorting Multiple Columns

  • Enhanced Data Clarity: Sorting helps in highlighting important trends and patterns within the dataset.
  • Improved Data Organization: Sorting multiple columns allows for a more structured and readable dataset.
  • Efficient Data Analysis: Makes it easier to compare and contrast different data points across multiple columns.

Steps to Sort Multiple Columns in Power Query

  1. Load Data: Import your dataset into Power BI.
  2. Open Power Query Editor: Navigate to the Power Query Editor to access your data.
  3. Select Columns: Choose the columns you want to sort.
  4. Apply Sorting: Use the sorting options to arrange the data in ascending or descending order.
  5. Save and Apply: Save your changes and apply the sorted data to your Power BI report.

Practical Applications

  • Sales Data Analysis: Sort sales data by date and product category to identify seasonal trends and top-performing products.
  • Employee Performance Review: Arrange employee data by department and performance score to streamline performance evaluations.
  • Inventory Management: Sort inventory data by stock levels and reorder dates to maintain optimal stock levels.

By mastering the technique of sorting multiple columns using Power Query in Power BI, you can significantly enhance your data analysis capabilities, ensuring that your insights are both accurate and actionable.

Implementation in Power BI:

We will go through these steps:

Happy learning!

1. Going through the Table:

The Sales table used

The table presents sales data for office supplies in Los Angeles, California, categorized under various columns. Here’s a detailed breakdown:

Columns in the Table:

  • City: This column indicates the city where the sales transactions took place.
  • State/Province: This column shows the state or province associated with each transaction.
  • Region: This column categorizes the transactions into broader regions, such as West, East, etc.
  • Category: This column specifies the type of products being sold, like Office Supplies, Furniture, etc.
  • Sales: This column provides the monetary value of the sales for each transaction.
  • Quantity: This column records the number of units sold in each transaction.

General Observations of the Data:

  1. Variety in Location: The transactions occur in multiple cities and states, not just Los Angeles, California. This indicates a broader geographical spread.
  2. Range of Categories: The data covers multiple product categories such as Office Supplies, Furniture, Technology, etc., showcasing a variety of business segments.
  3. Sales Figures: The sales amounts vary significantly, reflecting different transaction sizes and potentially diverse customer bases.
  4. Quantity Sold: There is a wide range in the number of units sold per transaction, suggesting varying customer demands and order sizes.
  5. Temporal Diversity: The data spans multiple time periods, which may indicate seasonal trends or changes in sales patterns over time.

The table helps in analyzing the sales performance of office supplies in a specific region, which can be useful for inventory management, financial planning, and market analysis.

2. Opening Power Query:

  • In the Home tab press on the Transform Data in the Queries section.
  • It will open the Power Query window.
In the Home tab press on the Transform Data in the Queries section

3. Sorting the first three columns:

  • Press on the City column and select Sort Ascending.
  • Now repeat the same process for State/Province and Region columns.
Press on the City column and select Sort Ascending

4. Sorting the Final three columns:

  • Press on the Category column and select Sort Descending.
  • Now repeat the same process for Sales and Quantity columns.
Press on the Category column and select Sort Descending

5. Checking the M Query:

  • In the APPLIED STEPS, you will find a Sorted Rows step being added.
  • Click on it and you will find the M Query for the sorting.
In the APPLIED STEPS, you will find a Sorted Rows step being added

You fill find this Query in the function bar section.

= Table.Sort(#”Removed Other Columns”,{{“City”, Order.Ascending}, {“State/Province”, Order.Ascending}, {“Region”, Order.Ascending}, {“Category”, Order.Descending}, {“Sales”, Order.Descending}, {“Quantity”, Order.Descending}})

Download the Data for the above comparison from this link.

Thank you for your attention!

Follow me or subscribe to get all my Power BI articles!

Don’t forget to subscribe to

👉 Power BI Publication

👉 Power BI Newsletter

and join our Power BI community:

Power Bi
Data Visualization
Business
Data Science
Finance
Recommended from ReadMedium