<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Bernardo Rainha on Medium]]></title>
        <description><![CDATA[Stories by Bernardo Rainha on Medium]]></description>
        <link>https://medium.com/@bernardo.rainha?source=rss-245eaef949a8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*0_GgqIMYxt1njPXblEMwNg.jpeg</url>
            <title>Stories by Bernardo Rainha on Medium</title>
            <link>https://medium.com/@bernardo.rainha?source=rss-245eaef949a8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 03:43:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bernardo.rainha/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Power Query: Simple Method to Avoid Typical Error File Combination]]></title>
            <link>https://medium.com/microsoft-power-bi/power-query-simple-method-to-avoid-typical-error-file-combination-e14b05bdfa9d?source=rss-245eaef949a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/e14b05bdfa9d</guid>
            <category><![CDATA[power-bi-tutorials]]></category>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[power-query]]></category>
            <category><![CDATA[power-bi]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Bernardo Rainha]]></dc:creator>
            <pubDate>Thu, 20 Apr 2023 07:56:49 GMT</pubDate>
            <atom:updated>2023-04-20T07:56:49.640Z</atom:updated>
            <content:encoded><![CDATA[<h4>Effective Error Handling Technique for File Combination in Power Query</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_Shifw7_kmo9X17i" /><figcaption>Photo by <a href="https://unsplash.com/pt-br/@jstrippa?utm_source=medium&amp;utm_medium=referral">James Harrison</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>When you combine files in a “traditional” way, you may have problems in the future.</p><p>To illustrate one of the typical errors of combining files from a folder, I will use this fictitious data of football matches by year. <br>In an initial phase, as in any project, all files will have the same structure (the same number and name of columns) and all sheets will have the same name, as can be seen in the screenshots below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*Iz7vsszUEU-SvaDgGXiE_A.png" /><figcaption>Folder with the files that I will work with</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*Dwpb5-CKAKrmvNu_uxV9uw.png" /><figcaption>File Structure and Sheet Name</figcaption></figure><p>Now we will move to Power BI, where I will show the typical steps to reach the final output, with all the data aggregated.<br>First, we will get the data from a folder, and show the folder path.<br>After that, we will “Transform Data” to combine the files, like the print below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/617/1*sTT9P5x5mA9ZMh71E9jq5g.png" /><figcaption>Get the files from the folder</figcaption></figure><p>Second, we will click on the “Combine Files” button to have the data structured like the excel file we saw previously.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3Tgf0oGePeES2u5ON4v15g.png" /></figure><p>Third, we will select “Sheet1” and click “OK”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*bW6g2l-N-Piz2gqCvPFOCg.png" /></figure><p>This is the output that we wanted!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*iXQBPjpaf8FEV1R0hzAiHA.png" /></figure><p>Now imagine that the business team (who performs this process manually) will extract data for the year 2023 from a company system and save it in the folder they usually use for this purpose. They don’t notice small details such as the name given on the Sheet. By coincidence, the name that remains is the year to which the games refer (2023).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*JaILwYcc7FmVxrRUBpeUtA.png" /><figcaption>2023 File Structure and Sheet Name</figcaption></figure><p>Let&#39;s refresh the previous results for this query and watch what happened.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*NK3Rw4QsPNQCm-FfFpjCPg.png" /></figure><p>When we already have some knowledge of Power BI (and have been through this before), we immediately understand what the error is. The easiest (and manual) solution we think of right away is to open the specific Excel file and rename the sheet.</p><p>What if I told you there is a way to avoid having to do this and not worry about these types of issues in the future? <br>Let’s do a step-by-step guide to avoid problems like the ones above! Curious? Let’s go!</p><p>First, you need to go to the “Transform File From Data” folder and click on the “Transform Sample File.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/326/1*QoIZl3eCXe2Hzn6qfAsqfg.png" /></figure><p>After doing that, in the right corner, you have the “Applied Steps.” If you’re not in the “Navigation” step, click it and check what’s in the formula bar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/244/1*F-oFRKHKlrBtoX2tMZXeig.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/1*upigiWkfAAliApogDLQayA.png" /></figure><p>You can see that a part of the code refers to the Sheet (Kind=”Sheet”) and another to the name given to the Sheet (Item=”Sheet1&quot;). <br>To avoid having this problem again, instead of asking Power BI to “search” for the sheet name (Sheet1) when combining the files in your folder, delete everything between the curly brackets and put the number of the sheet position in question. In our case, it would be the number 0. If we were talking about the second sheet, it would be number 1, and so on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*aB-Hz6zae8i6-XqryFEQiA.png" /></figure><p>By doing this, the problem will be overcome, and from then on, Power BI will not give you any more warnings since the data we are working with comes from an Excel file with only one page.</p><p>If you don’t want to combine the files using this methodology, please check out <a href="https://medium.com/artificial-corner/power-query-combine-data-from-a-folder-b2606a6bfd43">this article</a> that shows you another efficient approach to do it!</p><p>I hope you found it interesting, follow me for more nice tips and tricks!</p><blockquote>This article was published in <a href="https://medium.com/microsoft-power-bi"><strong>Microsoft Power BI publication</strong></a>, subscribe it for more interesting Power BI Tutorials, Tips and Tricks.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e14b05bdfa9d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/microsoft-power-bi/power-query-simple-method-to-avoid-typical-error-file-combination-e14b05bdfa9d">Power Query: Simple Method to Avoid Typical Error File Combination</a> was originally published in <a href="https://medium.com/microsoft-power-bi">Power BI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create Measures Table in Power Bi]]></title>
            <link>https://medium.com/microsoft-power-bi/create-measures-table-in-power-bi-47680e239ed?source=rss-245eaef949a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/47680e239ed</guid>
            <category><![CDATA[power-bi-tutorials]]></category>
            <category><![CDATA[power-bi]]></category>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[dax]]></category>
            <category><![CDATA[power-bi-tips-and-tricks]]></category>
            <dc:creator><![CDATA[Bernardo Rainha]]></dc:creator>
            <pubDate>Thu, 13 Apr 2023 08:03:43 GMT</pubDate>
            <atom:updated>2023-07-28T10:02:10.478Z</atom:updated>
            <content:encoded><![CDATA[<p>Learn the Two Essential Ways to Create a Measures Table</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hXOFtXSV0c-jYwmX" /><figcaption>Photo by <a href="https://unsplash.com/ja/@oskaryil?utm_source=medium&amp;utm_medium=referral">Oskar Yildiz</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>To have a more organized Power BI and to easily consult the measures we created throughout the development of the report, it is very important to have a specific table for this purpose. Currently, I know two ways to do this and I will demonstrate an example of each below.</p><h3>1. Enter Data</h3><p>Go to the Home Tab and click on “Enter Data”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*azVSxVuPVviNxrC34Vv45A.png" /></figure><p>In this step, you can name your measures table. <br>After creating the table, you can check on the right corner “Data” that the table is already there and has a column “Column1”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*e384jeKhm9_o2IM6WOiE1A.png" /><figcaption>Creating a Measures Table</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/339/1*lg-_8cHoH7FcszgN2hGhOg.png" /><figcaption>Measures Table visual after being created</figcaption></figure><p>Subsequently, measures can be added to the table in a standard manner. For instance, I added a metric named “# games”, as shown in the screenshot below. <br>As we always add a measure, we can after remove “Column1” as it serves no purpose.<br>Once done, the table icon will be changed to indicate that it is now a metric table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/334/1*irCC2RGeyypm1Et0O4tnuA.png" /><figcaption>Create a measure</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/334/1*lv-Wm2lAcxhZJXeRUpiZ3w.png" /><figcaption>The Metrics Table icon changed from “table” to “calculator”</figcaption></figure><p>This approach has a disadvantage, as when we “Enter Data”, it automatically creates a query that will be visible in Power Query. <br>It’s not necessarily a problem, but since we won’t be working on that query, it doesn’t make sense to have an extra query to clutter our workspace. <br>That is the key difference from the methodology I will explain in the next point.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/327/1*7rXXukBXd5UgW5trUcQh3g.png" /><figcaption>Queries showed in Power Query</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/246/1*IARs6p43AdTbN7dafS8_iA.png" /><figcaption>Steps applied in the Measures Table</figcaption></figure><h3>2. New Table</h3><p>This way of creating tables requires clicking on an existing query in the right corner of Power BI Desktop, in my case, it will be the “Data” query. After that, Power BI will automatically set the “Table Tools” tab, where we will find the “New Table” option and create the measures table.<br>Finally, you choose a table name and pick a number between curly brackets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/399/1*21QaFl-vfrzD--W2PRt2sw.png" /><figcaption>1st Step: Click on Data Query</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1007/1*sPPoTIon5myYIbEytFyukQ.png" /><figcaption>2nd Step: Click on “New Table”</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/1*DtNtCvGdLvR6ICQir6-gwQ.png" /><figcaption>3rd Step: Define a table name and pick a number between curly brackets</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/1*_k9q5YAI4cDv2JAP1C_sFw.png" /><figcaption>Measures Table created</figcaption></figure><p>Now, you can create a metric, and if you don’t want to see the “Value” option you can hide it, like the print below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/334/1*864pIxxXFEs7nYSZsJ-9ew.png" /><figcaption>Hide the “Value” attribute</figcaption></figure><p>As previously mentioned, when accessing Power Query, you will only encounter the “Data” query.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/321/1*1_DmO0vJRXcqI7BHQwggHQ.png" /><figcaption>Queries showed in Power Query</figcaption></figure><p>I hope you found it interesting!</p><p><em>This article was published in </em><a href="https://medium.com/microsoft-power-bi"><strong><em>Microsoft Power BI publication</em></strong></a><em>, don’t forget to sign it for more interesting Power BI Tutorials, Tips and Tricks.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=47680e239ed" width="1" height="1" alt=""><hr><p><a href="https://medium.com/microsoft-power-bi/create-measures-table-in-power-bi-47680e239ed">Create Measures Table in Power Bi</a> was originally published in <a href="https://medium.com/microsoft-power-bi">Power BI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Power Query: Combine Data from a Folder]]></title>
            <link>https://medium.com/artificial-corner/power-query-combine-data-from-a-folder-b2606a6bfd43?source=rss-245eaef949a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2606a6bfd43</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[power-bi]]></category>
            <category><![CDATA[power-query]]></category>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[low-code]]></category>
            <dc:creator><![CDATA[Bernardo Rainha]]></dc:creator>
            <pubDate>Sun, 02 Apr 2023 08:26:11 GMT</pubDate>
            <atom:updated>2023-04-02T08:26:11.664Z</atom:updated>
            <content:encoded><![CDATA[<h4>A Technique for Consolidating Files to Enhance the Readability of your Power Query</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KbP0fnOxUqTeXh82" /><figcaption>Photo by <a href="https://unsplash.com/ko/@safarslife?utm_source=medium&amp;utm_medium=referral">Safar Safarov</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The easiest way to combine data from a folder in Power Query is to click on the “Combine Files” button (in the “Content” column) as shown in the print below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*ZacCd4FW-9bwzHq7JviWPw.png" /></figure><p>This may not be the best approach if you have:</p><p>1- Many queries;</p><p>2- If you gonna delete your files over time.</p><p>The first point mentioned above is closely related to the organization and traceability of queries. When you use the “Combine Files” option in Power Query, a folder named “Transform Files from…” is automatically created, containing 4 queries attached to it. Imagine if you have data in 10 different types of folders to develop your Report, your Power Query would look like a mess!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/322/1*g1uEQHdouiNm6u5lQt0fsA.png" /><figcaption>The output of using the combine files button</figcaption></figure><p>The other point concerns the possibility of deleting files from one of these folders. Since this “method” relies on the first document in each folder for compilation, if that document is deleted, the report will result in an error.</p><p>To avoid this kind of problem, there is another approach available, the “Csv.Document” or “Excel.Workbook” formula. With these formulas, it is possible to obtain the data contained in the documents in a particular folder, without creating the 4 queries of the “Transform Files from…” folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*vHCVB3qxces4nS05ZqeMAw.png" /><figcaption>Csv.Document formula example</figcaption></figure><p>After adding the custom column with the formula mentioned above you just need to click on the “Expand” button to expand the data contained in the folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*5KasUqp12g4-kWneuebdaQ.png" /></figure><p><strong>Extra Tip:</strong> If you do it using “Excel.Workbook”, pay attention to the step below. Sometimes people go to the excel files and do some filters. This action can duplicate data. Let me show you an example with the “2015.xlsx” file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*Xw9-k2h4GSbAx92jRQzz0g.png" /></figure><p>Now, if I click on “Expand” in the “Custom” column, I will have a step that is not present in the CSV files, which shows me the name of the file and its respective sheets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*-oAG68OQlAaG9mkprlH56Q.png" /></figure><p>If I Expand the data in the “Data” column, I can see my data:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/1*mY3IHvieVPACXDUpHtOvqA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*dJMg2stNhnUo6zvQWa5-UA.png" /></figure><p>Imagine if I go to the excel file and add the filter header like the print below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*8gWdP6QldRBr9lFEi_ILQQ.png" /></figure><p>This is what happens in Power Query:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*lMTvHWTZeia3bec6zR4uoQ.png" /></figure><p>The data has been duplicated!</p><p>Let’s check the step after the creation of the “Custom” column, to see what changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*EADAeQZukUzj38O6rHkV_w.png" /></figure><p>Now that we’ve realized what changed from one situation to the other, we know what we need to do to avoid duplicating data. Just filter the “Kind” column to only show the type “Sheet”.</p><p>I hope you found it interesting and learned more about the potential of this approach!</p><h4>Artificial Corner’s Free ChatGPT Cheat Sheet</h4><p>We’re offering a free cheat sheet to our readers. <a href="https://frankandrade.ck.page/08c94cf1c1"><strong>Join our newsletter with 20K+ people and get our free ChatGPT cheat sheet.</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2606a6bfd43" width="1" height="1" alt=""><hr><p><a href="https://medium.com/artificial-corner/power-query-combine-data-from-a-folder-b2606a6bfd43">Power Query: Combine Data from a Folder</a> was originally published in <a href="https://medium.com/artificial-corner">Artificial Corner</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>