{"id":3835,"date":"2021-12-15T22:32:05","date_gmt":"2021-12-16T06:32:05","guid":{"rendered":"https:\/\/SUMMALAI.COM\/?p=3835"},"modified":"2021-12-15T22:32:07","modified_gmt":"2021-12-16T06:32:07","slug":"how-to-sort-one-column-by-another-column-in-power-bi","status":"publish","type":"post","link":"https:\/\/SUMMALAI.COM\/?p=3835","title":{"rendered":"How to Sort One Column by Another Column in Power BI"},"content":{"rendered":"\n<p>When you&#8217;re editing a report in Power BI Desktop, you can choose a column to define the sort order of another column by setting the&nbsp;<strong>Sort by column<\/strong>.<\/p>\n\n\n\n<p>Here&#8217;s a common example. You have a Month Name column, and when you add it to a visual, the months are being sorted alphabetically: April, August, December, February, and so on. Not ideal. You want them to be sorted chronologically. This article shows how to set the sort order of one column by a different column.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/docs.microsoft.com\/en-us\/power-bi\/create-reports\/media\/desktop-sort-by-column\/power-bi-alphabetical-sort-chart.png\" alt=\"Screenshot of Chart with months sorted alphabetically.\"\/><\/figure>\n\n\n\n<p>&nbsp;Note<\/p>\n\n\n\n<p>When you&#8217;re reading a report, you can also change how the values in a visual are sorted. See&nbsp;<a href=\"https:\/\/docs.microsoft.com\/en-us\/power-bi\/consumer\/end-user-change-sort\">Change how a chart is sorted in a Power BI report<\/a>&nbsp;for details.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"set-the-sort-by-column\"><a href=\"https:\/\/docs.microsoft.com\/en-us\/power-bi\/create-reports\/desktop-sort-by-column#set-the-sort-by-column\"><\/a>Set the Sort by column<\/h2>\n\n\n\n<p>To set a different column to sort by, both columns need to be at the same level of granularity. For example, to sort a column of month&nbsp;<em>names<\/em>, you need a column that contains a&nbsp;<em>number<\/em>&nbsp;for each month. The sort order will apply to any visual in the report that contains the sorted column. In the following example, the months are being sorted alphabetically, but we want them to be sorted chronologically.<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Select the column that you want to sort, in our case,&nbsp;<strong>Month<\/strong>. Note that the months in the visual are sorted alphabetically. In the&nbsp;<strong>Fields<\/strong>&nbsp;pane, the&nbsp;<strong>Column tools<\/strong>&nbsp;tab becomes active.<img decoding=\"async\" src=\"https:\/\/docs.microsoft.com\/en-us\/power-bi\/create-reports\/media\/desktop-sort-by-column\/power-bi-alphabetical-sort.png\" alt=\"Active Sort by Column button, visual sorted alphabetically\"><\/li><li>Select&nbsp;<strong>Sort by Column<\/strong>, then select the field you want to sort the other field by, in this case,&nbsp;<strong>Month Number<\/strong>.<img decoding=\"async\" src=\"https:\/\/docs.microsoft.com\/en-us\/power-bi\/create-reports\/media\/desktop-sort-by-column\/power-bi-new-sort.png\" alt=\"Sort by Column menu, select Month Number\"><\/li><li>The visual automatically sorts in the order we want: chronologically by the order of months in a year.<img decoding=\"async\" src=\"https:\/\/docs.microsoft.com\/en-us\/power-bi\/create-reports\/media\/desktop-sort-by-column\/power-bi-chronological-sort.png\" alt=\"Sort by Column menu, visual sorted chronologically\"><\/li><\/ol>\n\n\n\n<p>Below, you may want to watch a video if needed.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"3 Minutes Learning: Sort Month in Power BI\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/cnH6oMhWKOE?start=5&#038;feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>Ref: <a href=\"https:\/\/docs.microsoft.com\/en-us\/power-bi\/create-reports\/desktop-sort-by-column\">Sort one column by another column in Power BI Desktop &#8211; Power BI | Microsoft Docs<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/radacad.com\/sort-by-column-in-power-bi\">Sort By Column in Power BI &#8211; RADACAD<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you&#8217;re editing a report in Power BI Desktop, you can choose a column to define the sort order of another column by setting the&nbsp;Sort by column. Here&#8217;s a common example. You have a Month Name column, and when you add it to a visual, the months are being sorted alphabetically: April, August, December, February, <a class=\"read-more\" href=\"https:\/\/SUMMALAI.COM\/?p=3835\">Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[10,621],"tags":[987,986],"class_list":["post-3835","post","type-post","status-publish","format-standard","hentry","category-microsoft","category-power-bi","tag-ort-one-column-by-another-column","tag-ort-one-column-by-another-column-in-power-bi"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3835","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3835"}],"version-history":[{"count":2,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3835\/revisions"}],"predecessor-version":[{"id":3837,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3835\/revisions\/3837"}],"wp:attachment":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3835"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3835"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3835"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}