<?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 Arjun Bandi on Medium]]></title>
        <description><![CDATA[Stories by Arjun Bandi on Medium]]></description>
        <link>https://medium.com/@thetinyint?source=rss-e118e1571651------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*tC7HVKm8V5JxMh-RPmQ3-w.jpeg</url>
            <title>Stories by Arjun Bandi on Medium</title>
            <link>https://medium.com/@thetinyint?source=rss-e118e1571651------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 15:16:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@thetinyint/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[Why Are Ebooks Becoming So Costly?]]></title>
            <link>https://medium.com/@thetinyint/why-are-ebooks-becoming-so-costly-0a6e535be7ec?source=rss-e118e1571651------2</link>
            <guid isPermaLink="false">https://medium.com/p/0a6e535be7ec</guid>
            <category><![CDATA[open-knowledge]]></category>
            <category><![CDATA[publishing]]></category>
            <category><![CDATA[reading]]></category>
            <category><![CDATA[books]]></category>
            <category><![CDATA[education]]></category>
            <dc:creator><![CDATA[Arjun Bandi]]></dc:creator>
            <pubDate>Thu, 18 Jun 2026 11:05:24 GMT</pubDate>
            <atom:updated>2026-06-18T14:24:48.302Z</atom:updated>
            <content:encoded><![CDATA[<p>Lately, one question kept bothering me. How did ebooks become so costly?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bcCwNgCfiPgC1i0ajdINrA.png" /></figure><p>During my graduation days, ebooks moved freely. We mostly spent money only on printing and spiral binding. But today, I sometimes see an ebook costlier than the printed book. So, bytes are now costlier than paper and ink.</p><p>When I came across this <a href="https://youtu.be/PygUK16aQgk">TED</a> talk, the hidden business model became clear. We are not buying the book. We are buying access.</p><p>So problem goes beyond the price, it is digital ownership. When you buy a physical book, you own it forever. You can lend it to a friend, sell it to a store or donate it. But when you buy an ebook, you are not owning it. You are only buying permission to read it inside one specific platform.</p><p>Authors deserve money. Good publishing has real costs. But the current model is turning books into rented assets that are controlled by platforms. So the book is with you, but it behaves more like it belongs to the seller than to you.</p><p>When knowledge is easily accessible, others don’t just consume it. They build on it and that is how new knowledge is produced. If it is locked behind recurring subscriptions, people then spend more time searching and paying than actually learning.</p><p>I think open-source ideas matter beyond software. We need ways to keep learning material open and affordable. We need to protect and contribute to <strong>Open Knowledge Infrastructure</strong> before knowledge completely turns into another monthly subscription.</p><p>Here are few actions we can take:</p><ul><li>Use local public library apps to borrow digital media.</li><li>Find and read directly through initiatives like <a href="https://www.gutenberg.org/">Project Gutenberg</a>.</li><li>Download academic textbooks via the <a href="https://www.google.com/search?q=https://www.doabooks.org/">Directory of Open Access Books</a>.</li><li>Urge your colleges to replace expensive commercial textbooks with open access materials.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0a6e535be7ec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Five must-know #hacks in Power BI — Part 5]]></title>
            <link>https://medium.com/@thetinyint/five-must-know-hacks-in-power-bi-part-5-92d92bad8168?source=rss-e118e1571651------2</link>
            <guid isPermaLink="false">https://medium.com/p/92d92bad8168</guid>
            <category><![CDATA[power-query]]></category>
            <category><![CDATA[power-bi]]></category>
            <category><![CDATA[data-modeling]]></category>
            <dc:creator><![CDATA[Arjun Bandi]]></dc:creator>
            <pubDate>Sun, 17 May 2026 23:52:11 GMT</pubDate>
            <atom:updated>2026-05-19T11:44:06.834Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>Make Your Power BI Data Model Faster, Lighter and Smarter</strong></h4><ol><li><a href="#dce2">Data Loading</a> : Parallel vs Sequential Load</li><li><a href="#9d56">Single Table Refresh</a> : Load Only What You Need</li><li><a href="#e3ca">Helper Queries</a> : Disable Load For Helper Queries</li><li><a href="#4a34">Limiting Data</a> : Use Parameters to Limit Data During Development</li><li><a href="#2222">Query Folding</a> : Use Query Folding for Transformation Efficiency</li></ol><h3>1. Parallel vs Sequential Load</h3><p>When you are working with large datasets, sometimes a dashboard refresh may take longer than expected. One of the reasons for this is, Power BI tries to load all tables in parallel.</p><p>If the server has enough resources, this may work well. Otherwise, all tables trying to refresh at the same time can put more load on the system and slow down the overall refresh. Especially if datasets are huge.</p><p>To control this behavior, go to File &gt; Options and settings &gt; Options &gt; Data Load. Under <strong>Parallel loading of tables</strong>, you can disable parallel loading or limit (Custom) how many tables can parallelly load at the same time.</p><p>In <strong>some cases</strong>, reducing the parallel load or making the refresh sequential can help the data refresh run faster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Osb2LISHJiGpW8efCrL1lw.png" /><figcaption>Sequential Loading</figcaption></figure><p>On the same page, you will also notice settings for <strong>Time intelligence</strong> and <strong>Background Data</strong>. These options can also be disabled if not needed. Depending on your Power BI version, you may see these features already disabled, but it is still worth checking.</p><p><strong>Auto Date/Time</strong> creates hidden date tables in the background, which many users don’t realize. When your model has multiple date columns, it can increase model size and make refresh slower.</p><p><strong>Allow data previews to download in the background</strong> will make Power BI to evaluate previews in the background. With large data sources, this can make development feel slow.</p><p><em>Parallel less, load faster!</em></p><h3>2. Load Only the Table You Need</h3><p>When you are working on a large Power BI model, you may not always want to refresh all the tables just to test one small change. This is especially painful when the model has few heavy tables that take forever to load.</p><p>Power BI gives you a simple option for this.</p><p>On the <strong>Data </strong>pane, right-click on the table you want to test and select <strong><em>Refresh</em></strong>. This gives you options to refresh <strong>Data</strong>, <strong>Schema </strong>or <strong>both</strong>. If there are no metadata changes, like a new column added or a column data type changed, you can choose just <strong><em>Data</em></strong>. This helps reload the table faster without refreshing all other tables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*pwJSWNeqCSVxKN3s_30bxg.png" /><figcaption>Table Refresh</figcaption></figure><p><em>Refresh the whole model, you don’t always need to!</em></p><h3>3. Disable Load for Helper Queries</h3><p>This hack is related to Power Query. Not every query needs to be loaded into the data model. For example, let’s say you have an <strong>Inventory</strong> table. You do some basic cleanup on this table. Then you right-click the <strong>Inventory</strong> table, create a <strong>Reference</strong> table from it, and apply a few more transformations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2KOY5e6bjp4XzhAQMS__ZA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*orKnexjFFM_kkgtn48DYXA.png" /><figcaption>Create Reference Table</figcaption></figure><p>This new referenced table <strong>Inventory Corp, </strong>is the final table you want to use in your report. Now the original <strong>Inventory </strong>table is only acting as a helper query. You do not need to load it as a separate table into the model.</p><p>Right-click on the original<strong> Inventory </strong>(helper query) and uncheck <strong>Enable Load</strong>. Power BI will still use this query for the final referenced table, but it will not load the helper query as a separate table into the model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*kDhhRBzIIBD-g-k2ZlGpXg.png" /><figcaption>Uncheck Enable Load</figcaption></figure><p>When you do this, Power BI may show a data loss warning, which is fine in this case, you can click <strong>Continue</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/1*Bp6aCabsoMxf6cBOR-hGUQ.png" /><figcaption>Data Loss Warning</figcaption></figure><p>Also, if you have noticed, there is another option called <strong>Include in report refresh</strong>. This is different from <strong>Enable load</strong>. Sometimes, you may want to keep a table in the model but stop it from refreshing during data load. In that case, keep <strong>Enable load</strong> checked and uncheck only <strong>Include in report refresh</strong>. This is useful when you want the table to stay in the model, but you do not want it to refresh every time.</p><p>Now, when you reload the data, you will see only the final table loading into the model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t-tFRCJW_u3o2RK44sMiYA.png" /><figcaption>Data Refresh</figcaption></figure><p>Another hack is when you are still developing the model, don’t load heavy tables every time. Keep them as helper queries until the model is ready. By doing this you can avoid heavy refresh cycles during iterative changes to the dashboard.</p><p>You can use a similar approach for static tables too. If a table is static or rarely changes like archive data or lat/long info, you can keep it loaded in the model but uncheck <strong>Include in report refresh</strong>. This way, the table is still available for reporting, but Power BI will not refresh it every time.</p><p><em>Helper it is, heavy reload you avoid!</em></p><h3>4. Use Parameters to Limit Data During Development</h3><p>When you are building a report, you do not always need to load the full dataset during development.</p><p>For example, let’s say your source table has five years of contracts data. If you are only working on the report layout, fixing transformations, testing relationships or validating measures, loading all five years of data every time is not needed.</p><p>One simple way to keep your data model light during development is by filtering data directly at the source step. For this, in Power Query, click the settings icon next to the <strong>Source</strong> step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2KOY5e6bjp4XzhAQMS__ZA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M-rgHY-vxsvFjqbgk8BURQ.png" /><figcaption>View Source Settings</figcaption></figure><p>This will open the database connection window. Now, under the <strong>SQL statement</strong>, you can change the query and add a date filter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*33m24AHzuJZoieZ1BDUZow.png" /><figcaption>Edit SQL Query</figcaption></figure><p>This keeps the data refresh faster and makes Power BI Desktop easier to work with.</p><p>For a more dynamic approach, you can create parameters to limit the data. For example, you can create parameters like <strong>StartDate </strong>and <strong>EndDate </strong>and use them to filter the source data. During development, you can set these parameters to load only the last one month or one quarter of data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4vfMsGzo7jP2FrQKocbnzQ.png" /><figcaption>Create New Parameters</figcaption></figure><p>After creating parameters, open <strong>Advanced Editor</strong> and update the query to use date parameters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*4weWq8rUCwNcYH3GdGxR_w.png" /></figure><pre>#Before<br><br>let<br>    Source = Sql.Database(parServer, parDatabase),<br>    dbo_PPDM_CONTRACTS = Source{[Schema=&quot;dbo&quot;,Item=&quot;PPDM_CONTRACTS&quot;]}[Data]<br>in<br>    dbo_PPDM_CONTRACTS</pre><pre>#After<br><br>let<br>    // Compose sql query with date parameters to filter data<br>    var_sql_qry = &quot;SELECT * FROM DBO.PPDM_CONTRACTS <br>                    WHERE LASTMODIFIEDDATE <br>                        BETWEEN &#39;&quot; &amp; parStartDate &amp; &quot;&#39; AND &#39;&quot; &amp; parEndDate &amp; &quot;&#39;&quot;,<br>    // Use the filtered query to fetch data from database<br>    Source = Sql.Database(parServer, parDatabase, [Query=var_sql_qry])<br>in<br>    Source</pre><p>For production, I prefer native query parameters or using source side views or stored procedures where possible.</p><p><em>Load small, build fast!</em></p><h3>5. Use Query Folding for Transformation Efficiency</h3><p>Sometime, though we apply filters in Power Query but they don’t limit data fetching from source. This is because of how <strong>Query Folding </strong>works.</p><p>Query Folding pushes your transformation steps back to the source system. For example, if you apply a date filter in Power Query, it may convert that step into a SQL WHERE condition and ask SQL Server to filter the data first.</p><p>In hack #4, we applied the date filter directly in the SQL query. Lets say, you apply the same filter as a Power Query step thinking it will have the same effect. It might, but only if <strong>Query Folding</strong> works.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*12QQsm19InM3gU-HL5xPFw.png" /><figcaption>Power Query Column Filter</figcaption></figure><p>The catch here is, you cannot force every step to fold, it will fold where it can. In our case it did not.</p><p>You can check this behavior by right-clicking the filter step and selecting <strong>View Native Query</strong>. If the option is enabled, Power Query is folding that step back to the source. If it is disabled, folding broke at that step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/327/1*DBurYETJEV_VW1o7kuFB8w.png" /><figcaption>Native Query Disabled</figcaption></figure><p>When query folding breaks, Power BI stops pushing transformations back to the source database. Instead, it pulls all the raw data from the source and applies the filter locally. A report that should refresh in 30 seconds suddenly takes 10 minutes.</p><p>This happened in our example because when we use a custom SQL statement in the Source step, it limits folding. To fix this, go to <strong>Advanced Editor</strong> and change the script</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*4weWq8rUCwNcYH3GdGxR_w.png" /></figure><pre>#Before<br><br>let<br>    <br>    Source = Sql.Database(parServer, parDatabase, [Query=&quot;SELECT * FROM dbo.PPDM_CONTRACTS&quot;]),<br>    Filtered_Rows = Table.SelectRows(Source, each [CREATEDDATE] &gt;= #datetime(2026, 1, 1, 0, 0, 0) and [CREATEDDATE] &lt;= #datetime(2026, 5, 1, 0, 0, 0))<br>in<br>    Filtered_Rows</pre><pre>#After<br><br>let<br>    <br>    Source = Sql.Database(parServer, parDatabase),<br>    PPDM_CONTRACTS = Source{[Schema=&quot;dbo&quot;,Item=&quot;PPDM_CONTRACTS&quot;]}[Data],<br>    Filtered_Rows = Table.SelectRows(PPDM_CONTRACTS, each [CREATEDDATE] &gt;= #datetime(2026, 1, 1, 0, 0, 0) and [CREATEDDATE] &lt;= #datetime(2026, 5, 1, 0, 0, 0))<br>in<br>    Filtered_Rows</pre><p>Now you will notice that <strong>View Native Query</strong> is enabled and Power Query is able to send the filter back to SQL Server as seen in the <strong>Native Query</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R6cmR0AvHSYUEIfwgdMRzA.png" /><figcaption>Native Query Enabled</figcaption></figure><p>Common <strong>folding-breakers</strong> to avoid early in your query:</p><ul><li>Adding index columns</li><li>Combining tables from different sources</li><li>Using complex custom functions</li><li>Certain complex date manipulations</li></ul><p>The simple rule is, keep <strong>folding-friendly </strong>steps first, like apply filters, remove columns, join tables, and group data. Keep <strong>folding-breaking </strong>steps towards the end of the query.</p><p><em>Fold early, refresh fast!</em></p><p>For more hacks please read…</p><p><a href="https://medium.com/@thetinyint/five-simple-hacks-in-power-bi-d94b6d0ceede">Five must-know #hacks in Power BI — Part 1</a></p><blockquote>Useful, they may be. Download the sample files from <a href="https://github.com/thetinyint/pbi/tree/main/Five%20Hacks%20-%20Part%205">here</a>, you can! -Yoda.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92d92bad8168" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Five must-know #hacks in Power BI — Part 4]]></title>
            <link>https://medium.com/@thetinyint/five-must-know-hacks-in-power-bi-part-4-c7da47e16b9e?source=rss-e118e1571651------2</link>
            <guid isPermaLink="false">https://medium.com/p/c7da47e16b9e</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[dax]]></category>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[power-bi]]></category>
            <dc:creator><![CDATA[Arjun Bandi]]></dc:creator>
            <pubDate>Mon, 28 Aug 2023 17:13:57 GMT</pubDate>
            <atom:updated>2023-08-31T11:23:10.786Z</atom:updated>
            <content:encoded><![CDATA[<h3>Five must-know #hacks in Power BI — Part 4</h3><ol><li><a href="#08fd">Top 10 filter</a> — to display top performers or bottom laggers.</li><li><a href="#7462">Totals as % </a>— convert values to percentages for better readability.</li><li><a href="#3487">Bubble chart</a> — convert a simple scatter plot into a bubble chart.</li><li><a href="#7aab">Vertical scrolling</a> — to fit more visuals on a single page.</li><li><a href="#6b3b">Folder structure</a> — to effectively organize measures and columns.</li></ol><h3>1. Top 10 filter</h3><p>To bring quick attention to the data, displaying the top or bottom data elements proves to be an effective method. This can be achieved through two methods.</p><h4>Method 1</h4><p>This quicker approach involves using the Filters panel. Add a vertical bar chart to the canvas and place “Customer Name” on the Y-axis and “Profit” on the X-axis from the orders dataset (download link provided at the bottom).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ze31JebFStoFzVqfARTQpA.png" /></figure><p>Keep the visual selected to show its fields in the <em>Filerts </em>panel. You will notice three different sections in this panel 1. Filters on this visual 2. Filters on this page and 3. Filters on all pages. Under the 1st section <em>Filters on this visual</em>, expand “Customer Name” and change the <em>Filter type </em>to <em>Top N. </em>Under <em>Show items</em>, you can set a number to display <em>Top </em>or <em>Bottom </em>data elements (in this case Customer Names). Drag and drop the “Profit” column into to <em>By value </em>shelf (this can be the same value field that is used on the chart or a different field). Finally, click on <em>Apply Filter </em>to see the effect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5-aZaEu8z13rUhdksnAjsg.png" /></figure><h4>Method 2</h4><p>The second method is to use a DAX measure to calculate the Rank for each customer. I will first write an expression for “Total Profit” and then use it inside the RANKX function.</p><pre>Total Profit=SUM(Orders[Profit])<br>Customer Rank=RANKX(ALL(Orders[Customer Name]),[Total Profit],,DESC,Dense)</pre><p>Using the ALL() function inside RANKX() exposes the entire customer list for the rank function to rank each customer correctly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/377/1*PcCHylGBfBxpFMy_cSSquQ.png" /></figure><p>Now add this newly created “Customer Rank” measure to the <em>Filters </em>panel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GaIHcMh7jVVmukGgxmbhWQ.png" /></figure><p>Select <em>is less than or equal to</em> under <em>Show items</em>, and enter the value 10 to show only the top 10 customers on the chart.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ic2GvzMvdQwStWNNPGfcEQ.png" /></figure><p>Rank function supports two types of ranking, dense or skip. Below is an illustration to understand the difference between them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/479/1*o4s7kEHRtoJS9ngvVegLyg.png" /></figure><h3>2. Totals as %</h3><p>It&#39;s much easier to read values as percentages than the actual numbers. In Power BI we can present percentages in two ways.</p><h4>Method 1</h4><p>On-the-fly conversions of values into percentages. For this, open the value field drop-down, select <em>Show value as</em>, and then select <em>Percentage of grand total.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*kFbayCBrYtKQKhyAZWBrhw.png" /></figure><p>This will convert totals on the Y-axis into percentages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lfPSgP6toBf5FTdFlxmtXQ.png" /></figure><h4>Method 2</h4><p>The same can be done more formally using a DAX measure.</p><pre>Profit % = <br>DIVIDE([Total Profit]<br>    ,CALCULATE([Total Profit],ALLSELECTED(Orders))<br>)</pre><p>On the X-axis (as we are using a vertical bar chart, otherwise Y-axis) replace the actual “Profit” column with this newly created “Profit %” measure.</p><p>In case you want to show the % value for each customer based on total customers (not just the top 10), then you should use the ALL() function instead of ALLSELECTED ().</p><pre>Profit % = <br>DIVIDE([Total Profit]<br>    ,CALCULATE([Total Profit],ALL(Orders))<br>)</pre><p>The ALL() or ALLSELECTED() functions will first do the overall total of all customers and then divide them with each customer’s total to show us the % share of each customer over all the customers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L-IIm_Cs_pNvn3tCpz1-Vg.png" /></figure><h3>3. Bubble Chart</h3><p>This is one of my favorite charts. We can create this using a Scatter plot. Take “Shipping Cost” on the X-axis, and “Sales” on the Y-axis with “Customer Name” on Values. We just plotted a correlation between two metrics.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tPsbVNZ4A4V8tN2rO_q2QQ.png" /></figure><p>Now add “Profit” (third metic) to Size, this will convert the Scatter plot into a Bubble chart. Turn on category labels to display customer names. The size of the bubble is determined by the sum of “Profit”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OsG9MWqZ7JQ9Di4PyBTuEA.png" /></figure><h3>4. Vertical Scrolling</h3><p>Sometimes it is good to put all the visuals on a single page to give a comprehensive look into a business use case. We can do this by adjusting the Canvas width and height according to the space requirement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/269/1*Z7R0BM2GwZwf9Vr1pHKn1w.png" /></figure><p>Now navigate to the <em>View </em>menu and select <em>Fit to width </em>option. This will enable vertical scrolling on your dashboard creating an experience similar to a web page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ven9wT_medOHd-IBCB-5-A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7oIX3ty32Km0TYb2HLJVGg.gif" /></figure><h3>5. Folder Structure</h3><p>When you are working on a large dataset with a lot of columns, scrolling through the list requires a lot of effort. One easy way to manage this is to create folders to organize columns and measures.</p><p>Navigate to <em>Model view </em>and select the table you want to organize. Hold Ctrl and click on related columns so they are selected as a group. Go to the <em>Properties </em>panel and enter a name under the <em>Display folder. </em>This will group the columns into a common folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J7feh66JNujNF9tyrymkcg.png" /></figure><p><em>For more hacks please read…</em></p><p><a href="https://medium.com/@enridge/five-simple-hacks-in-power-bi-d94b6d0ceede">Five must-know #hacks in Power BI - Part 1</a></p><p><em>Sample files can be downloaded from </em><a href="https://github.com/Enridge/blog/tree/bc2c3709a1f2ff44281195fa234613005e609477/Power%20BI/Five%20Hacks%20-%20Part%204"><em>here</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7da47e16b9e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Five must-know #hacks in Power BI — Part 3]]></title>
            <link>https://medium.com/@thetinyint/five-must-know-hacks-in-power-bi-part-3-fed6a3033fa3?source=rss-e118e1571651------2</link>
            <guid isPermaLink="false">https://medium.com/p/fed6a3033fa3</guid>
            <category><![CDATA[excel]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[power-bi]]></category>
            <dc:creator><![CDATA[Arjun Bandi]]></dc:creator>
            <pubDate>Mon, 21 Aug 2023 06:42:41 GMT</pubDate>
            <atom:updated>2023-09-03T15:00:40.444Z</atom:updated>
            <content:encoded><![CDATA[<h3>Five must-know #hacks in Power BI — Part 3</h3><ol><li><a href="#a2d4">Custom colors</a> on a chart visual — apply color formatting to a chart</li><li><a href="#fcc6">Custom sort</a> on a visual — sort a column based on another column</li><li><a href="#6539">Modify data</a> in a custom table — re-edit a custom table</li><li><a href="#dc7e">Multi-sort</a> on a table visual — sort a visual based on multiple columns</li><li><a href="#3756">Copy table</a> — export full table out of Power BI</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*T5lL6ZXmU7-9_Xv6" /><figcaption>Photo by <a href="https://unsplash.com/@isaacmsmith?utm_source=medium&amp;utm_medium=referral">Isaac Smith</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>1. How to apply auto coloring on a visual</h3><p>If in case you want to apply multiple colors to a bar chart, you will have to navigate to the <em>Columns </em>section of the visual formatting blade and then go to <em>Colors</em> properties and turn on <em>Show all to </em>set colors to each bar individually.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/1*audg2-CN6OdLvmuE-dg2fg.png" /><figcaption>Bar chart colors</figcaption></figure><p>This isn’t an effective method. There are three ways to automate this. The first approach is a quick one (although I don’t often recommend it).</p><p>1. Add the same field that’s on <em>X-axis</em> to <em>Legend </em>(in this example “Awarded Type”) to automatically set different colors for each bar. But the drawback is that you cannot use <em>Legend</em> for any other field. If you can forgo legend, you can opt for this approach.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*50ZcLNvcGaWmlpmqh6gw-Q.png" /><figcaption>Bar chart colors</figcaption></figure><p>Two other things to be taken care of in this method - select “<em>Stacked column chart</em>” instead of “<em>Clustered column chart</em>” and turn off the <em>Legend</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*bke1aoUqcArsE0CNnGIZzg.png" /><figcaption>Multi-color bar chart</figcaption></figure><p>2. Create a DAX column on the “Opportunites” table by defining color codes for each “Awarded Type”</p><pre>Awarded Type Color = <br>SWITCH(Opportunities[Awarded Type]<br>        ,&quot;Renewal&quot;,&quot;#DB6917&quot;<br>        ,&quot;New Business&quot;,&quot;#F4D407&quot;<br>        ,&quot;Additional Business&quot;,&quot;#8EBA43&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TkHSKmmf4rLOuNOAF1bCtQ.png" /></figure><p>Now go to the bar chart and click on the <em>fx </em>icon under the color properties. In the following dialog box select the newly created DAX column that has all color codes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*GIoY4Od8pmkmWjyrJLaX5A.png" /></figure><p>Finally, the bar chart will be colored based on the codes provided in the DAX column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*Ij_GBDqdKtxbr0fGdyq9pQ.png" /><figcaption>Multi-color bar chart</figcaption></figure><p>3. The third approach is to save the same color codes in a custom table instead of a DAX column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*Gg4sI-EF8xgOJUqSMMX7Rg.png" /><figcaption>Custom table with color codes</figcaption></figure><p>After adding the table, create a relation between this new table and the main table “Opportunities”, using the common column, “Awarded Type”. You can do this by dragging and dropping the field from one table into another table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/1*uyTvk16-5mGcXOvLC7iyiQ.png" /><figcaption>Table relationships</figcaption></figure><p>Make sure that you select <em>Both </em>for <em>Cross filter direction</em> on the relationship properties. You can set this property by double-clicking on the relationship line.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d6sLGEhqD0k0vprbvfOK6g.png" /><figcaption>Relationship properties</figcaption></figure><p>Now go to the bar chart and repeat the same step you did in method 2</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*0Ww7WdIqqmtYcSPD6PlzGQ.png" /><figcaption>Expression for bar color</figcaption></figure><h3>2. How to apply custom sorting on a visual</h3><p>Generally, the default sort applied on visual is a dictionary/alphabetic sort, which sometimes may not be useful for us.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*ZJFUqC3ih7JXrqXigchw3g.png" /><figcaption>Sorting on visual</figcaption></figure><p>For example, in the visual above, I want to sort the x-axis based on a user-defined order, <em>Discovery-&gt; Qualifying -&gt;Proposal-&gt;Negotiation </em>instead of the default dictionary sort. In such a case, we must define the sorting order using a custom table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*Fd9C-oLANkZR2o43DBj6xQ.png" /><figcaption>Custom table with sort sequence</figcaption></figure><p>After adding the custom table, create a relationship between the “Opportunities” table and the “Status Order” table using the “Status” column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*4O-BcezfV41LmcznhO_49A.png" /><figcaption>Table relationship</figcaption></figure><p>Now, go to the data view and add a DAX column “Status Order” to the main table “Opportunites”. We must do this as the sort feature needs the order column to be in the main table where the original “Status” column is present.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oUkCpJjkg7LFqZ_UPX6IpA.png" /><figcaption>Adding dax column</figcaption></figure><pre>Status Order = RELATED(&#39;Status Order&#39;[Order])</pre><p>Finally, select the “Status” column in the “Opportunities” table, click on the <em>Sort </em>icon in the <em>Home </em>menu, and then select the newly added DAX column “Status Order”. This will sort the x-axis as per the order we defined in the custom table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-LG2FQq5RhZErXeI9PORCw.png" /><figcaption>Set secondary sort column</figcaption></figure><h3>3. How to modify data in a custom table</h3><p>After you are done creating a custom table, you will notice that you cannot edit it in the data view. You see a read-only view, so if you need to make any modifications to the data or add new data, you must go to the <em>Power Query</em> editor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*p0a-196HrQ3lTZJS9_hZOw.png" /><figcaption>Table View — Read-only</figcaption></figure><p>To open Power Query, navigate to the <em>Home </em>tab and click on the <em>Power Query </em>editor icon.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*Hj2jjgzZgxgTavv_ErQ67A.png" /><figcaption>Power Query — Launch Button</figcaption></figure><p>On the Power Query editor select the custom table and click on Source settings</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s_mH7KwbW-Q2XIvMJfGiUw.png" /><figcaption>Power Query Editor</figcaption></figure><p>This will open up the custom table in edit mode so you can modify or enter new records.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*Yg0RdVM1TDqQK5JMDSIUQQ.png" /><figcaption>Custom table in edit mode</figcaption></figure><p>Click OK to go back to the Power Query editor and click on <em>close and apply </em>to apply the changes to the Power BI desktop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PPDrWg7k0j9psXwKWz3rgA.png" /><figcaption>Power Query Editor — Close &amp; Apply</figcaption></figure><p>As you can see, a new record is added to the custom table “Status Order”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/1*D2WABWxPsCzjBAdh7HC3mw.png" /><figcaption>Power BI Desktop — Table View</figcaption></figure><h3>4. How to apply multi-sort on a visual</h3><p>This Power BI tip might seem very basic, but until I knew it, I struggled with it myself. Sorting a table using multiple columns is something we often need to do while presenting data in a flat report. To achieve this on a table visual, just hold the <em>Shift</em> <em>key</em> and click on the column(s) you want to sort by. Click twice on the same column to toggle between ascending and descending sort.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bpxomiJH-GJXv9GS9wA8yg.gif" /><figcaption>Table Visual</figcaption></figure><p>Shift+Click doesn’t work in a Matrix visual, but if you want to apply multi-sorting, here’s a workaround. Start by creating it as a table visual, apply the multi-sort, and then convert it to a Matrix. The sort order will persist even after flipping the Table into a Matrix visual.</p><h3>5. How to copy an entire table</h3><p>All visuals in Power BI provide an option to <em>Export data </em>out of Power BI. You can add the required fields to a table visually and then export them to a file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*nbrosOvpQE5OfweAcCGbUg.png" /><figcaption>Table visual — Export data</figcaption></figure><p>Alternatively, you have the option to copy the entire table. This option is not visible on the report view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1owB_B3ouE3HUSF--Il63Q.png" /><figcaption>Report View</figcaption></figure><p>For this, you have to navigate to table view and then right-click on the table you want to copy to see the <em>Copy table </em>option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uk_7axxexlhEWUAK3xehgQ.png" /><figcaption>Table View</figcaption></figure><blockquote>For more hacks please read…</blockquote><p><a href="https://medium.com/@enridge/five-must-know-hacks-in-power-bi-part-4-c7da47e16b9e">Five must-know #hacks in Power BI — Part 4</a></p><blockquote>Useful, they may be. Sample files, download from <a href="https://github.com/Enridge/blog/tree/eb99130248a50026afdbdea04566b0961d374e4d/Power%20BI/Five%20Hacks%20-%20Part%203">here</a>, you can!</blockquote><blockquote>For more stories, follow you should! -Yoda.</blockquote><p><a href="https://medium.com/@enridge">Enridge - Medium</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fed6a3033fa3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to make #API calls using Azure Data Factory]]></title>
            <link>https://medium.com/@thetinyint/how-to-make-api-calls-using-azure-data-factory-7a813356757f?source=rss-e118e1571651------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a813356757f</guid>
            <category><![CDATA[etl]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[azure-data-factory]]></category>
            <category><![CDATA[pipeline]]></category>
            <dc:creator><![CDATA[Arjun Bandi]]></dc:creator>
            <pubDate>Mon, 14 Aug 2023 17:38:13 GMT</pubDate>
            <atom:updated>2023-08-20T06:55:54.935Z</atom:updated>
            <content:encoded><![CDATA[<p>Calling an API to fetch a response either in text or JSON format is a common scenario we come across while building data pipelines. To accomplish this using Data Factory, we have a Web activity that supports different HTTP methods for making API calls. Let’s dive in and explore it.</p><p>For this story, I will be using a set of Vehicle Identification Numbers (VIN) captured at check-in kiosks using scanning devices. Each VIN is a unique 17-character code assigned to each vehicle by the manufacturer. It can be further decoded to extract a whole range of vehicle specifications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nkOxcRSqMqEt0lRDfVYnoA.png" /><figcaption>VIN</figcaption></figure><p>I will post these VINs to a public API (NHTSA) to pull the complete vehicle profile. Using this data I will proceed to build a VIN database. So let&#39;s begin.</p><p>Prerequisites — below is the sample API request that will be sent to <a href="https://vpic.nhtsa.dot.gov/api/vehicles/DecodeVINValues/1C4RJYE63P8827841?format=json"><em>https://vpic.nhtsa.dot.gov</em></a><em> </em>to get complete vehicle information</p><blockquote>API Request</blockquote><p><a href="https://vpic.nhtsa.dot.gov/api/vehicles/DecodeVINValues/1C4RJYE63P8827841?format=json"><em>https://vpic.nhtsa.dot.gov/api/vehicles/DecodeVINValues/&lt;&lt;VIN_CODE&gt;&gt;?format=json</em></a></p><blockquote>Example call</blockquote><p><a href="https://vpic.nhtsa.dot.gov/api/vehicles/DecodeVINValues/1C4RJYE63P8827841?format=json"><em>https://vpic.nhtsa.dot.gov/api/vehicles/DecodeVINValues/1C4RJYE63P8827841?format=json</em></a></p><blockquote>API Response</blockquote><pre>{<br>  &quot;Count&quot;: 1,<br>  &quot;Message&quot;: &quot;Results returned successfully&quot;,<br>  &quot;SearchCriteria&quot;: &quot;VIN(s): 1C4RJYE63P8827841&quot;,<br>  &quot;Results&quot;: [<br>    {<br>      &quot;ABS&quot;: &quot;Standard&quot;,<br>      &quot;Make&quot;: &quot;JEEP&quot;,<br>      &quot;Manufacturer&quot;: &quot;FCA US LLC&quot;,<br>      &quot;Model&quot;: &quot;Grand Cherokee&quot;,<br>      &quot;ModelYear&quot;: &quot;2023&quot;,<br>      &quot;BodyClass&quot;: &quot;Sport Utility Vehicle (SUV)&quot;,<br>      &quot;BrakeSystemType&quot;: &quot;Hydraulic&quot;,<br>      .......<br>      .......</pre><p>On the Azure side, we must set up three resources. I will not go into details of setting them up but if someone is interested I will write a follow-up article.</p><ol><li>A Blob (Storage Account) — that contains a set of VIN codes and acts as our source.</li><li>A Pipeline (Data Factory) — to bring VINs from Blob and send them to API via HTTP request.</li><li>A Table (Azure SQL) — to store VIN specifications returned by API and a stored procedure to insert these records into the target table.</li></ol><pre>CREATE TABLE VIN_DETAILS (<br>   VIN_CODE VARCHAR(255),<br>   MAKE  VARCHAR(255),<br>   MODEL  VARCHAR(255),<br>   MODEL_YEAR  VARCHAR(255),<br>   MANUFACTURER  VARCHAR(255),<br>   BODY_CLASS  VARCHAR(255),<br>   INSERTED_TIMESTAMP DATETIME<br>)<br><br>CREATE PROC USP_INSERT_VIN_DETAILS(<br>   @VIN_CODE VARCHAR(100),<br>   @MAKE VARCHAR(100),<br>   @MODEL VARCHAR(100),<br>   @MODEL_YEAR VARCHAR(100),<br>   @MANUFACTURER VARCHAR(100),<br>   @BODY_CLASS VARCHAR(100),<br>   @INSERTED_TIMESTAMP DATETIME) AS<br>BEGIN<br>INSERT INTO VIN_DETAILS(<br>   VIN_CODE,<br>   MAKE,<br>   MODEL,<br>   MODEL_YEAR,<br>   MANUFACTURER,<br>   BODY_CLASS,<br>   INSERTED_TIMESTAMP)<br>VALUES(<br>   @VIN_CODE,<br>   @MAKE,<br>   @MODEL,<br>   @MODEL_YEAR,<br>   @MANUFACTURER,<br>   @BODY_CLASS,<br>   @INSERTED_TIMESTAMP)<br>END</pre><h3>Steps to setup the Pipeline</h3><h4>Blob</h4><p>Below is the simple blob in which VIN codes are recorded on a daily basis</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q1uSWUM3zaPknYfiSWBk_w.png" /></figure><h4>Data Factory</h4><p>Step 1 — Launch Azure Data Factory Studio to create a linked service to the Blob. I need to have the Storage account name and key handy before I create the linked service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WMFBhQ3EsH5zTx1SOOcM_g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*Meta8WfsBC3OGYIy4imexw.png" /><figcaption>Storage Account — Linked Service</figcaption></figure><p>Step 2 — Create the second linked service that points to the Azure SQL server. For this, I will keep the server name, user id, and password handy. I will use the SQL authentication type to connect to the database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bEm7CGyVsNEi0f7Bbxt1hA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*68fIF6HI1e-9-KYsmXuanQ.png" /><figcaption>Azure SQL — Linked Service</figcaption></figure><p>Step 3 — Create a dataset for the blob using the storage account linked service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3iDaVmBL9p4g5KPLmpK8RQ.png" /><figcaption>Blob dataset</figcaption></figure><p>Step 4 — Create a dataset to point to the target table using database linked service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gkVWHNJOHAdV2xFREackKQ.png" /><figcaption>Table dataset</figcaption></figure><p>Step 5 — Create a pipeline and add a Lookup activity to it. Select the blob dataset as the source and uncheck the <em>First row only </em>property.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*Jb6bx7oXOcsY2u0-10BN5Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*HpwEEo2gAUXbd4ovaez1zw.png" /><figcaption>Lookup activity configuration</figcaption></figure><p>Step 6 — Add ForEach activity following the Lookup activity. Under <em>Items </em>set the expression to get the list of VIN Codes. You can frame the expression by looking at the output parameters of the Lookup activity. This expression will provide the list of codes to ForEach activity to iterate through them and pass on each VIN to activities inside it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*pCRm8XGX5b2awOR9e_oAnA.png" /><figcaption>Lookup activity output</figcaption></figure><pre>@activity(&#39;Lookup1&#39;).output.value</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*G6k8t1SSUJxbp9cibWNpgA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1009/1*GxBFUURaFd0PKYNfEWNREw.png" /><figcaption>ForEach activity configuration</figcaption></figure><p>Step 7 — Edit ForEach activity and add Web activity inside of it. In the URL text box add an expression to append VIN_CODES to the API request URL. In this expression, the item() function will bring us a single VIN code for each iteration of ForEach activity. Choose the GET method from the second dropdown.</p><pre>@concat(&#39;https://vpic.nhtsa.dot.gov/api/vehicles/DecodeVINValues/&#39;<br>    ,item().VIN_CODES,&#39;?format=json&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*XDzxjBhCpd58OH-Ng_PgGA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*stPuGnfjwrpbl5DuKgDhdA.png" /><figcaption>Web activity configuration</figcaption></figure><p>Step 8 — Add a Stored procedure activity following Web activity to parse the incoming JSON response of Web activity and insert it into the target table. To write the expression for parsing JSON response, take a look at the output parameters of Web activity as sown in the below screenshot. For this demo, I am considering file fields from the full set of JSON key-value pairs below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*CtJfqFOvctkhKKLmJYxU_g.png" /><figcaption>Web activity output</figcaption></figure><pre>@activity(&#39;Web1&#39;).output.Results[0].ModelYear</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*0npGSTPzBLK9_yKB8z-AAg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Jt5nwceTP8Zn71orvCtww.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JaJiWpn683gSCA-GVKHVvw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rhMBjRwFl4KMGEcSyR5_dA.png" /></figure><p>Step 9 — Final view of the pipeline. Hit debug to perform a test run.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sxr9E3FU3-EuLcMFVMOXew.png" /><figcaption>Final Pipeline</figcaption></figure><p>Step 10 — Run the select query on the target table to check the final output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i6pVdiJ0nrD0OO8KquS9Tg.png" /><figcaption>Target table output</figcaption></figure><p>Conclusion — Using Azure Data Factory we build a pipeline using Web activity to make API/HTTP requests and inbuilt expression/javascript capabilities to parse the API response. We also used a ForEach activity to loop through the list of incoming VIN Codes.</p><p>For more information about the VIN decoding APIs</p><p><a href="https://vpic.nhtsa.dot.gov/decoder/">Welcome to VIN Decoding :: provided by vPIC</a></p><blockquote>Sample files can be downloaded from <a href="https://github.com/Enridge/blog/tree/e7147c9139bd779dd83eb7a2e0a18b1de5d8b96b/Data%20Factory/API%20Calls">here</a></blockquote><p><em>For more articles please follow</em></p><p><a href="https://medium.com/@enridge">Enridge - Medium</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a813356757f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to do #what-if analysis using Power BI]]></title>
            <link>https://medium.com/@thetinyint/how-to-do-what-if-analysis-in-power-bi-28da817a05d3?source=rss-e118e1571651------2</link>
            <guid isPermaLink="false">https://medium.com/p/28da817a05d3</guid>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[power-bi]]></category>
            <category><![CDATA[dax]]></category>
            <category><![CDATA[power-query]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Arjun Bandi]]></dc:creator>
            <pubDate>Mon, 07 Aug 2023 17:11:18 GMT</pubDate>
            <atom:updated>2023-08-08T17:13:49.365Z</atom:updated>
            <content:encoded><![CDATA[<p>What-if analysis is a technique applied to understand the potential impact or sensitivity of a metric/KPI. It allows a user to explore and drive the analysis based on their input. In the following story, we’ll explore how to set up a scenario-based what-if analysis using numeric sliders.</p><p>In the world of finance, the <strong>Operating Ratio </strong>is a key metric that indicates a company’s ability to control costs while keeping up revenues. It is derived by dividing total costs (total operating expenses — OPEX) by net revenue. The smaller the ratio, the greater the company’s ability to generate profit.</p><p>For this story, I will be using the revenue data of a logistics corporation. First, I’ll create measures for Total Revenue, Total Cost, and Total Margin along with Operating Ratio which will be our what-if indicator.</p><pre>Total Revenue = SUM(&#39;freight_bills&#39;[Revenue])<br>Total Costs = SUM(&#39;freight_bills&#39;[Total costs])<br>Total Margin = [Total Revenue]-[Total Costs]<br>Operating Ratio = DIVIDE([Total Costs],[Total Revenue],0)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XSArbJUQhue0d9K-MlwOtw.png" /></figure><p>To take the user input for Operating Ratio, we will set up a parameter by navigating to the <em>Modeling </em>menu and selecting a <em>Numeric range </em>type <em>Parameter</em>. Set the minimum value as 0 and the maximum as 100 (0 to 100%) with an increment value of 10 (or appropriate values for your indicator).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oAYIzosVJRfeHK8b6aN5Og.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EVKMh2b2dZFD5Goh1h93zA.png" /></figure><p>Adding this parameter will create a new DAX table with a single column and a single value measure.</p><pre>Whatif_CR_Parm = GENERATESERIES(0, 100, 10) //Table<br>Whatif_CR_Parm Value = SELECTEDVALUE(&#39;Whatif_CR_Parm&#39;[Whatif_CR_Parm], 50) //Measure</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gm6tZHrfCnnB7RuPoTqY1g.png" /></figure><p>From this table, we will use “Whatif_CR_Parm Value” to create our next set of what-if measures</p><pre>Operating Ratio (Wt-If) = DIVIDE(Whatif_CR_Parm[Whatif_CR_Parm Value],100,0)<br>Total Costs (Wt-If) = [Total Revenue] * [Operating Ratio (Wt-If)]<br>Total Margin (Wt-If) = [Total Revenue]-[Total Costs (Wt-If)]</pre><p>I will rearrange the dashboard to accommodate newly created what-if measures. I also added three separate bar charts to show the change in Costs and Margins separately. We kept revenue fixed so we can see the change in the other two metrics.</p><p>One small hack I used here to keep the scales of all three charts fixed, is to add the “Total Revenue” measure as the maximum value for the y-axis. I made an assumption here that costs cannot be greater than revenue. This may or may not be applicable to your business scenarios, so you can set a value more relevant to your dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mpkCEVLyj2T5LXufqYvQAg.png" /></figure><p>As we move through the what-if slider, we can observe its impact on Costs and Margins. Lowering the Operating Ratio results in reduced costs and increased margins</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v2ids3IaYPfSIJf0AW44zw.gif" /></figure><h4>Using the custom table:</h4><p>In place of a <em>Numeric range </em>parameter, you can also use a custom table to set up the what-if indicator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*Drc6lK4ZuNQ3CXhAUgC1oQ.png" /></figure><p>Next, set up a slicer with the column of this table and also create a measure using the same column. This measure can then be incorporated into your what-if measures.</p><pre>Whatif_CR_Parm Value = SELECTEDVALUE(&#39;Whatif_CR_Parm&#39;[Whatif_CR_Parm], 50) //Measure</pre><blockquote><em>Sample files can be downlaoded for </em><a href="https://github.com/Enridge/blog/tree/9bc3220da41d1c8fcc7889043dc1182f66083b43/Power%20BI/What-if%20Analysis"><em>here</em></a></blockquote><p>For more reading</p><ul><li><a href="https://www.forbes.com/sites/joelshapiro/2020/07/28/the-right-and-wrong-ways-to-use-what-if-analysis/?sh=5f532b012b98">The Right And Wrong Ways To Use &#39;What-If&#39; Analysis</a></li><li><a href="https://www.investopedia.com/terms/o/operatingratio.asp">Operating Ratio: Definition and Formula for Calculation</a></li></ul><p>Please follow, for other posts of mine</p><p><a href="https://medium.com/@enridge">Enridge - Medium</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=28da817a05d3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to apply #dynamic measures in Power BI]]></title>
            <link>https://medium.com/@thetinyint/different-ways-to-use-dynamic-measures-in-power-bi-448e226667c1?source=rss-e118e1571651------2</link>
            <guid isPermaLink="false">https://medium.com/p/448e226667c1</guid>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[power-bi]]></category>
            <category><![CDATA[dax]]></category>
            <category><![CDATA[power-query]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Arjun Bandi]]></dc:creator>
            <pubDate>Mon, 31 Jul 2023 13:43:50 GMT</pubDate>
            <atom:updated>2023-08-06T15:49:57.499Z</atom:updated>
            <content:encoded><![CDATA[<p>Sometimes, to avoid overcrowding a dashboard, using dynamic measures is an effective approach. With them, you can easily switch the same visual or even an entire dashboard across multiple measures and/or formattings.</p><h3>Method 1: Custom table</h3><p>In the chart below, we are showing the “Total Miles” measure split by “State” and “Trip Type”. I want to show two other measures “Loaded Miles” and “Loaded Miles Ratio” on the same visual. So let&#39;s see how to achieve this using dynamic measures.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*FtHILRj24Lx10XgMQfKnKw.png" /></figure><p>Let’s create all three measures using DAX.</p><pre>Total Miles = SUM(Trips[TotalMiles])<br>Loaded Miles = SUM(Trips[LoadedMiles])<br>Loaded Miles Ratio = DIVIDE([Loaded Miles],[Total Miles],0)</pre><p>Add a custom table to provide options for letting users select “Measure Names”, also include the “Order” column for sorting names.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*YiqMgoWmPdUUsTncUkBGQQ.png" /><figcaption>Custom table with user input</figcaption></figure><p>Create a dynamic measure that can switch between three measures based on the user selection.</p><pre>Dynamic Measure =<br>SWITCH (<br>    VALUES ( &#39;Measures List&#39;[Measure Name] ),<br>    &quot;Total Miles&quot;, [Total Miles],<br>    &quot;Loaded Miles&quot;, [Loaded Miles],<br>    &quot;Loaded Miles Ratio&quot;, [Loaded Miles Ratio]<br>)</pre><p>Now, go back to the visual and replace “Total Miles” with this dynamic measure. Add a slicer on top of the visual to show the list of measure names from the custom table. To sort the measure names on the slicer, change the sort order for “Measure Name” to use “Measure Order”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/356/1*iYLIFy9UyEtjewKskhDIcQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*uJ-Titdo2M1xNs3HgGocvw.gif" /></figure><p>We are almost done, except for two formatting changes.</p><p>Formatting 1 — Disable the y-axis title since there is currently no support for adding an expression here. However, you can set a visual title using a measure.</p><pre>Dynamic Title = <br>VALUES(&#39;Measures List&#39;[Measure Name]) &amp; &quot; by Origin State and Trip Type&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/285/1*KJima8EoVoQuA2OLuULGNw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*ldrAAoRMHykuME1VcJoRQQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*w7tczNskKYL5HfWHdgjhkA.png" /></figure><p>Formatting 2 — When the “Loaded Miles Ratio” is selected, values are shown as decimals instead of percentages. This is because all measures are formatted the same way. To set dynamic formatting, select “Dynamic Measure”, go to the <em>Format </em>menu, and select the <em>Dynamic </em>option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dSopiPwLy7PubxU89gB7bQ.png" /></figure><p>Then set the formula bar to <em>Format </em>and enter below DAX expression</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RiAmp8QoBc63cq3egl7Bmg.png" /></figure><pre>SWITCH (<br>    VALUES ( &#39;Measures List&#39;[Measure Name] ),<br>    &quot;Total Miles&quot;, &quot;#,0.00 K&quot;,<br>    &quot;Loaded Miles&quot;, &quot;#,0.00 K&quot;,<br>    &quot;Loaded Miles Ratio&quot;, &quot;0.00%&quot;<br>)</pre><p>Finally, you have a visual that can switch measures dynamically along with their applicable formats.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*djGe2DnliMXV9HE2HGWAwg.png" /></figure><h3>Method 2: Filed Parameters</h3><p>In this method, we will use a field parameter instead of a custom table. To do this, open the <em>New parameter </em>dropdown under the <em>Modelling </em>menu and select <em>Fields.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WKItSwX2u1Sz_-KqmsxJ1w.png" /></figure><p>In the next dialog box, select our three measures and click <em>Create</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jgu4ORqnqHAfa1IqnKNM0w.png" /></figure><p>After this, change the expressions of dynamic measure, dynamic title, and format to use the newly created field parameter “Measures Parm”.</p><pre>Dynamic Measure =<br>SWITCH (<br>    VALUES ( &#39;Measures Parm&#39;[Measures Parm] ),<br>    &quot;Total Miles&quot;, [Total Miles],<br>    &quot;Loaded Miles&quot;, [Loaded Miles],<br>    &quot;Loaded Miles Ratio&quot;, [Loaded Miles Ratio]<br>)<br><br>Dynamic Title = <br>VALUES(&#39;Measures Parm&#39;[Measures Parm]) &amp; &quot; by Origin State and Trip Type&quot;<br><br>&lt;&lt;Format&gt;&gt;<br>SWITCH (<br>    VALUES ( &#39;Measures Parm&#39;[Measures Parm] ),<br>    &quot;Total Miles&quot;, &quot;#,0.00 K&quot;,<br>    &quot;Loaded Miles&quot;, &quot;#,0.00 K&quot;,<br>    &quot;Loaded Miles Ratio&quot;, &quot;0.00%&quot;<br>)</pre><p>Finally, you have the visual that can switch between three measures.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*3AhDes6P2f7iJLWP7BNqtw.png" /></figure><h3>Method 3: Bookmarks</h3><p>This method doesn’t involve DAX. We will use a series of bookmarks to switch between different views (measures).</p><p>First, create three <em>Blank</em> buttons and change their <em>Text </em>to our measure names<em>. </em>Create three copies of the same bar chart (one for each measure) and stack them one on top of another.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*Jr4QVaDgISP3V9hNQOag_A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H3lkZb-zA8YgYde_X13Kxw.png" /></figure><p>If you open the <em>Selection </em>panel, you can see three charts and three buttons. Change names for each button to match their text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5MfxWqfgz2hRKhFnn_Kf-Q.png" /></figure><p>Open the <em>Bookmarks</em> panel, and create three bookmarks of the same page. Change the name of the bookmarks to match our measure names. On the first “Total Miles” bookmark, hide the “Loaded Miles” and “Loaded Miles Ratio” bar charts to show only “Total Miles” bar chart. Do likewise for the other two bookmarks as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jJDNUyEb2FEiowlFbnNlyA.png" /></figure><p>Finally, go to <em>Actions </em>of each button and select the corresponding bookmark and you are done. To test this you can ctrl+click on each button and see the bar chart switching measures on the y-axis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T75jocOtzYLp4RFvcNdqtw.png" /></figure><p>Conclusion — If you are not familiar with DAX expressions, you can choose method 3. However, this method can become difficult to maintain if you have a lot of visuals on the dasbhaord. Method 1 and 2 are almost identical with 2nd being a simplified version of 1st, thanks to intoduction of <em>field parameters, </em>though it is still a preview feature. I will prefere Method 2 as it is easy to maintian and doesn’t require custom sorting.</p><blockquote>Sample files can be downlaoded for <a href="https://github.com/Enridge/blog/tree/b336988e63c095e7aed0382686b1beccd71bb519/Power%20BI/Dynamic%20Measures">here</a></blockquote><p>Seek more articles, you must. Follow, you can! -Yoda</p><p><a href="https://medium.com/@enridge">Enridge - Medium</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=448e226667c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Five must-know #hacks in Power BI — Part 2]]></title>
            <link>https://medium.com/@thetinyint/five-must-know-hacks-in-power-bi-part-2-fa464ec4613a?source=rss-e118e1571651------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa464ec4613a</guid>
            <category><![CDATA[power-query]]></category>
            <category><![CDATA[power-bi]]></category>
            <category><![CDATA[dax]]></category>
            <dc:creator><![CDATA[Arjun Bandi]]></dc:creator>
            <pubDate>Mon, 24 Jul 2023 10:09:29 GMT</pubDate>
            <atom:updated>2023-09-01T08:44:39.720Z</atom:updated>
            <content:encoded><![CDATA[<ol><li><a href="#2118">Excel-like — tabular view on a Matrix visual</a></li><li><a href="#3627">Switch to rows — to enhance the readability of measures on a Matrix</a></li><li><a href="#3006">Show missing data — to display all labels on x-axis</a></li><li><a href="#fd95">Switch to a hierarchical view — to better organize labels on x-axis</a></li><li><a href="#9eab">Use a secondary scale — to display variance between measures</a></li></ol><h3>1. Excel-like — tabular view on a Matrix visual</h3><p>When you are working with a Matrix visual in Power BI, one of the common ask from clients is to show rows as a flat view instead of a hierarchical (step) view. For those familiar with Excel pivot tables, they refer to it as a Tabular view. We can achieve the same view in Power BI by disabling the <em>Stepped Layout</em> option under the <em>Row headers </em>settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/357/1*l5shbfxZMdUMQUwmP6qChQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*FzguClbND6ZHFxnncdh9TQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*Bt1V6_Qap-IM_hdkSXw3RA.png" /><figcaption>Tabular view for Matrix visual</figcaption></figure><p>And in case you want to remove sub-totals, go to <em>Row subtotals </em>settings, select individual columns under the <em>Row Level </em>dropdown, and turn off <em>Show subtotal </em>option</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/272/1*q0nH-q5JjPrdnfWaB0oaww.png" /><figcaption>Turn of row subtotals</figcaption></figure><h3>2. Shift to rows — to enhance the readability of measures on a Matrix</h3><p>When you have multiple measures on the matrix, the headers can become crowded, leading to increased horizontal scrolling. To switch to vertical view, go to the <em>Values</em> settings and turn on <em>Switch values to rows</em>. This shift will help simplify the presentation and improve readability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*EEJnkGXQGwmRsIuxsbQjXA.png" /><figcaption>Measures on columns</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/276/1*Hl7Chk_CjtpD2xMa5bxLNQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*5SkbhEZGUVJKfa_AlCteAw.png" /><figcaption>Measures on rows</figcaption></figure><h3>3. Show missing data — to display all lables on x-axis</h3><p>When an x-axis contains too many labels, it may hide some and choose to display only a few labels. To reveal all the labels, navigate to the <em>x-axis </em>settings and change the <em>Type </em>to <em>Categorical. </em>This will make sure that all labels are visible and provide a comprehensive view of the data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*pr-Qo1kAIXUCBWIE6VTeAA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*Ri1uDrgAuWt326G-uJyAPg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*aJHNf4WNd4xRrbWE4yNRJg.png" /><figcaption>Continuous vs Categorical x-axis</figcaption></figure><h3>4. Switch to a hierarchical view — to better organize labels on x-axis</h3><p>hen multiple fields are present on x-axis, it will sometimes concatenate the labels. To make the presentation more readable you can convert them to a hierarchical view by navigating to the <em>x-axis </em>settings and turning off <em>Concatenate labels</em> option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*O_3UPN5orWPp5pJac7IUKw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/267/1*sLA3oW6TdU_GI_QhjMnSpg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*IpoCgZJuwZUuGOSiS1tZ7Q.png" /><figcaption>Concatenated vs Hierarchical view</figcaption></figure><h3>5. Use a secondary scale — to display variance between measures</h3><p>In case you want to show the correlation between two measures, if the variance is too high, it becomes difficult to visually read the data. In the case of the below chart, the “Total Opportunities” line is completely grounded and you can hardly make any difference between the two lines.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*5fbxThvJ13WWLedIctV3kQ.png" /><figcaption>Two measures on one scale</figcaption></figure><p>To fix this, move the “Total Opportunites” filed into the <em>Secondary y-axis. </em>This will create a new y-axis on the right side with a new scale. Now, on the left, we have “Total Opportunities” on a scale of 10s, and on the right we have “Pledged Volume” on a scale of 1000s.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/272/1*McTqe8CTcJCNm2HvepJvcw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/273/1*KphrXRSEicUICz4FTPPLiA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*QBbl6SxNaGG9vmqtZoj6Mw.png" /><figcaption>Two measures on two scales</figcaption></figure><blockquote>For more hacks please read…</blockquote><p><a href="https://medium.com/@enridge/five-must-know-hacks-in-power-bi-part-3-fed6a3033fa3">Five must-know #hacks in Power BI — Part 3</a></p><p>Useful, they may be. Sample files, download from <a href="https://github.com/Enridge/blog/tree/aa709f2ffc4d246932c49bc2b9e0c55783476515/Power%20BI/Five%20Hacks%20-%20Part%202">here</a>, you can! -Yoda.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa464ec4613a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Five must-know #hacks in Power BI — Part 1]]></title>
            <link>https://medium.com/@thetinyint/five-simple-hacks-in-power-bi-d94b6d0ceede?source=rss-e118e1571651------2</link>
            <guid isPermaLink="false">https://medium.com/p/d94b6d0ceede</guid>
            <category><![CDATA[power-bi]]></category>
            <category><![CDATA[power-query]]></category>
            <category><![CDATA[dax]]></category>
            <dc:creator><![CDATA[Arjun Bandi]]></dc:creator>
            <pubDate>Mon, 17 Jul 2023 10:42:51 GMT</pubDate>
            <atom:updated>2023-09-01T08:14:27.930Z</atom:updated>
            <content:encoded><![CDATA[<ol><li><a href="#790e">Replace blank data labels with zeros — to improve data visibility</a></li><li><a href="#de8b">Draw a dynamic benchmark line — to compare actuals vs. target</a></li><li><a href="#1be6">Add a chart to the tooltip — for better insights into details</a></li><li><a href="#3e57">Stack visuals evenly — for a uniform layout</a></li><li><a href="#03d2">Overlap visuals — to bring more data together</a></li></ol><h3><strong>1. Replace blank data labels with zeros — to improve data visibility</strong></h3><p>Although it may seem straightforward, it can actually become tricky sometimes. Let’s consider an example where you have two related tables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/1*o_Tbu69Hy0TERGRO7Rh5cg.png" /><figcaption>Table: Asset Class</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/1*T56NDiiZ7-TB0XD0_7jy3w.png" /><figcaption>Table: Asset Hours</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*v0B-bEc_xAhLpvJJox788Q.png" /><figcaption>Relationships on common key Asset Number</figcaption></figure><p>Add a bar chart to display the “total hours” for each asset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*jvfybMer4KKwWpp4R2qB2A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*juiG95nooFyDjIdwINe_AA.png" /><figcaption>Bar chart and its field settings</figcaption></figure><p>Asset Numbers without hours are not shown on the chart yet. To bring them up select “Show items with no data”...</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*OSDww1pf2IB3XhE0yuxZLA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*HY0I77vMbk8qvuQqcww6Qg.png" /><figcaption>Show items with no data on the bar chart</figcaption></figure><p>Although it displays missing Assets Numbers now, it doesn’t show anything on data labels as there are no entries for them in the “Asset Hours” table. Let’s say we want to see “zeros” instead of nothing for those Assets.</p><p>I will create a measure for Total Hours which uses ISBLANK() function to display “zeros”</p><pre>Total Hours =<br>VAR varScanHours = SUM ( &#39;Asset Hours&#39;[Hours] )<br>RETURN<br>    IF ( ISBLANK ( varScanHours ), 0, varScanHours )</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*IFVI-qNIfjPDq-ln2uLg9A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*tINknsftB3F1Ig29Y8i5hg.png" /><figcaption>Replace Y-axis with the DAX measure</figcaption></figure><p>But it doesn’t work, because DAX is scoped to the “Asset Hours” table and since there are no entries for those assets in that table, it doesn’t produce the expected outcome. To get around this problem, we can use a simple (dirty) trick in the DAX measure, we will add a non-significant decimal zero number to the sum to get around this.</p><pre>Total Hours = SUM ( &#39;Asset Hours&#39;[Hours] ) + 0.0001</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*qHlfSkGiQtbV9mIoi2JCKw.png" /><figcaption>Bar chart that shows zeros for missing data</figcaption></figure><h3>2. Draw a dynamic benchmark line — to compare actuals vs target</h3><p>If we have to cover a business use case that requires comparing Target vs Actuals, then we can add a target line that runs across the above bar chart. This target line (or benchmark) serves as a reference point and allows for easy visual comparison between the actual hours and the target hours for each asset.</p><p>To do this, select the bar chart and navigate to the “Analyses” menu and then click on “Constant line”. If you go by its name, you may think it doesn’t support dynamic values (adjustable based on the user input).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*g8f32QcjIRLxvchDubZsXA.png" /><figcaption>Analyses settings of the Bar chart</figcaption></figure><p>But when you click on “+ Add line” you can see that there are options to enter either a constant value or set an expression(<em>fx</em>) that can change dynamically.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/268/1*UHNOhsQhtCq8ATwz9opq9A.png" /><figcaption>Constant line options</figcaption></figure><p>So, let&#39;s create a DAX measure to calculate target hours assuming 12hrs of operations per day. Click on the <em>fx </em>icon next to the line value and select this newly created “Target Hours” measure.</p><pre>Target Hours = DISTINCTCOUNT(&#39;Asset Hours&#39;[Scan Date]) * 12</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*_-ZGzlReKPpXGmH55LYMeQ.png" /><figcaption>Line expression(fx) settings</figcaption></figure><p>Next, turn on the Data label, change the<em> Horizontal position</em> to <em>Right</em>, set <em>Style</em> to <em>both</em>, and rename the line as “Target Hours”. Voila! now you can see a line that runs across the chat and acts as a benchmark to compare with.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*Xryn_kGCvRwzkPyPAh9ngA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/1*F3OvxUzAuh1hydDtKTnysA.png" /></figure><h3>3. Add a chart to the tooltip — for better insights into details</h3><p>In Power BI, there are different techniques to show a lower level of detail. Tooltips, Drill-downs, and Drill-throughs are the most commonly used approaches. Tooltips can also be used to show detailed/sub-charts.</p><p>Create a new tab titled “Daily Trend — Tooltip” and then go to <em>Canvas settings </em>to set the <em>Type </em>as <em>Tooltip</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*FczOG2uKp8NKxZNI3pFSBA.png" /></figure><p>Add an area chart to this new page to show a daily trend of total hours.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uPscLhatFbp32-TN3UrjkQ.png" /><figcaption>Add area chart</figcaption></figure><p>Go to the first page, select <em>General </em>settings of the bar chart, and expand the <em>Tooltips &gt; Options</em>. For <em>Type</em> select <em>Report page </em>and for <em>Page </em>select the newly created page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T7YXWNZhVoFcPPq-VGQWiw.png" /><figcaption>Set tooltip options for the bar chart</figcaption></figure><p>Now hover on the bar chart to show daily trends for each asset. The tooltip is smart enough to filter the area chart based on the selected bar(Asset).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*Pi_WClKi_TsveKQ_EGuORg.png" /><figcaption>Daily trend area chart on the tooltip</figcaption></figure><p>However, we have a minor issue here, this tooltip page has some extra space at the top. How can we fix that? Unfortunately, size settings are greyed out. Therefore, let’s change the canvas <em>Type </em>to <em>Custom </em>and then adjust the page height. Your tooltip settings on the first page will still work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l6Aa9s-joncp6udrzGierw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ONKUnpEP6clMdeCInGH4kg.png" /><figcaption>Remove extra space from the tooltip page</figcaption></figure><p>The final view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*kCj-MtjbluB9fghkjavoYQ.png" /><figcaption>Daily trends on the tooltip</figcaption></figure><h3>4. Stack visuals evenly — for a uniform layout</h3><p>Sometimes it gets messy when you have to add multiple visuals to the dashboard. Group formatting options can help us out in such situations. Let’s add a few KPIs to the dashboard.</p><p>As you can see, they are unevenly placed and non-uniformly sized.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GlN011Q5Eq45DHY0c02iYA.png" /><figcaption>Unevenly placed KPI cards</figcaption></figure><p>Let’s do a couple of things to fix this. First, select all the KPI cards, navigate to <em>General Properties</em>, and set a fixed <em>Height </em>and <em>Width.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Di6-J4hSH6aaiqnP8V_Pw.png" /><figcaption>Set size properties for the group of cards</figcaption></figure><p>Second, move the first and last cards to opposite corners creating some gap so the rest of the cards can be aligned between them. Now, navigate to the <em>Format </em>menu to select <em>Align middle</em>, and <em>Distribute horizontally </em>to evenly layout KPI cards.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K1mUzgzqjLUydXvbaj45vQ.png" /><figcaption>Select all KPI cards to align them</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1foaZTlfEJm9eM8KgXU4BA.png" /><figcaption>Evenly distributed KPI cards</figcaption></figure><h3>5. Overlap visuals — to bring more data together</h3><p>Power BI provides the flexibility to freely move visuals across the dashboard and even overlap them. This feature will come handy when you want to extend a visual to show some additional information.</p><p>Continuing with our Asset dashboard, first, create a drought chart to display the distribution of hours across different Asset Classes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*8qukV3BU1ONYYaI6KytEsA.png" /><figcaption>Create a donut chart</figcaption></figure><p>Second, create a card to show the total hours and then remove its background color.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*sT7jF_Xd5Lyf68h3jDEMug.png" /><figcaption>Create a KPI card</figcaption></figure><p>Now drag this card to the center of the drought chart. Navigate to the <em>Format</em> menu and select <em>Bring forward </em>to place the card in the foreground<em>. Group</em> both visuals so it&#39;s easy to resize or move them together.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*SVob87CpPMhnba-nIMPp7g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*Q_yJla1deFCwplEJxZ8iKA.png" /><figcaption>Order and group the visuals</figcaption></figure><p>We have a slight problem here, when you make a few selections on the donut chart (after publishing it to the cloud), you will notice that the card has disappeared. This happens because Power BI thinks that you want to bring the donut chart to the foreground.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*3ND0XXdzUYGLnqPDRJywYw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*9GXqANrUr-x3hPXFCMIdaA.png" /><figcaption>KPI card disappears on the cloud</figcaption></figure><p>To fix this, remove the background color for the donut chart, add a rectangle shape on top of it, and set the shape’s background to white.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*qCzf8_QSQGvDNj_SsSEaMg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*iS5qsq3x7VvznKMgtmba_Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/869/1*VZNViiKiG7NmLyfGWhrO7g.png" /><figcaption>Add a rectangle shape on top of the donut chart</figcaption></figure><p>This time we will do the stacking (<em>Layer order</em>) and grouping using the <em>Selection </em>panel under the <em>Format </em>menu. In the <em>Selection </em>panel, move Shape (rectangle) into the group we created earlier and place it at the end (bottom of the stack). This arrangement will make sure that card is always visible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*7JgOQVj8oDbBV7SbTPfY8w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*ZYqCmdV9oEemUUZcy6ui8A.png" /><figcaption>Use the Selection panel to order and group visuals</figcaption></figure><p>Final view of the dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v03HcC3xvw-MG4qENBPPdQ.png" /><figcaption>Asset Utilization Dashboard</figcaption></figure><blockquote>For more hacks please read…</blockquote><p><a href="https://medium.com/@enridge/five-must-know-hacks-in-power-bi-part-2-fa464ec4613a">Five must-know #hacks in Power BI - Part 2</a></p><p>Useful, they may be. Sample files, download from <a href="https://github.com/Enridge/blog/tree/aa709f2ffc4d246932c49bc2b9e0c55783476515/Power%20BI/Five%20Hacks%20-%20Part%201">here</a>, you can! -Yoda.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d94b6d0ceede" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to highlight data #errors in Power BI]]></title>
            <link>https://medium.com/@thetinyint/how-to-highlight-error-data-in-power-bi-487ef4feca1d?source=rss-e118e1571651------2</link>
            <guid isPermaLink="false">https://medium.com/p/487ef4feca1d</guid>
            <category><![CDATA[power-query]]></category>
            <category><![CDATA[power-bi]]></category>
            <dc:creator><![CDATA[Arjun Bandi]]></dc:creator>
            <pubDate>Sun, 09 Jul 2023 04:29:56 GMT</pubDate>
            <atom:updated>2023-08-09T00:56:48.024Z</atom:updated>
            <content:encoded><![CDATA[<p>When working on Power BI, we often run into data errors, and very often they are due to datatype mismatches. Instances like text data appearing on numeric columns, numeric data on date columns are run-of-the-mill. Unfortunately, because of these type mismatches, data is blanked out in Power BI.</p><p>Original data:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*J9g3g2d8mJNTR60rJtuJWA.png" /><figcaption>Source data in Excel</figcaption></figure><p>In Power BI:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*I773U4yp3ZG-9UhOg0Vtyw.png" /><figcaption>Table visual showing original data in Power BI</figcaption></figure><p>This situation can be better handled using Power Query. We can separate out data rows with errors and show them in a different tab. We can also highlight this error data for businesses to easily identify and fix them. In the next data refresh, if these errors are corrected, they will automatically disappear from this errors tab and appears along with the main data.</p><p><strong>This is how the error tab will look like:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*bVBKa3nHLR5iJOHR9wFP5A.png" /><figcaption>Table visual showing errors in Power BI</figcaption></figure><p>Disclaimer! This method might result in duplication of data. To display the data that caused errors, it is necessary to duplicate non-text columns. However, based on my experience, you don’t have to worry about every single column. Typically, you only need to focus on non-text fields that are in date or numeric format. I’m not claiming that this method is the best, but it can be utilized effectively with limited data, especially when your data originates from files where data entry is done manually. Databases usually handle this issue in their schema design.</p><h4>So let&#39;s see how this can be done.</h4><p>Notice errors caused by text data appearing in non-text columns. If you don’t see these errors, that means data types are not defined yet. You can use “Detect Data Type” option or click on the icons next to each column name manually to set appropriate data type.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2KQhxDkhEZQJ9WgGTzth4Q.png" /><figcaption>Errors due to datatype mismatch in Power Query</figcaption></figure><p>Create duplicate columns for these non-text fields and set a suffix “Org” to the column names. Make sure the data types of these duplicate columns are set to text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*hps9S0utrrc00dhYgG9ubg.png" /><figcaption>Create duplicate copies of non-text columns</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/846/0*Zh-pXDKG8NHUuZjW" /><figcaption>Add suffix Org to newly created columns</figcaption></figure><p>Add an index column to the table in case you don’t have any unique keys in the data, this step is optional.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*sXuHVJPY4HwqGdQJg9Al5Q.png" /><figcaption>Add a unique index column</figcaption></figure><h4>Creating errors table.</h4><p>Clone the main table and name it as “Projects_Errors”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*-yvyFfR2OUOTmq8A2-6K4w.png" /><figcaption>Clone main table</figcaption></figure><p>On this newly created table, click on “Keep Errors”. Make sure you don’t select any column before you perform this action.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*isvpAZBv7XkCvQe3Ex0x3w.png" /><figcaption>Keep only errors in new table</figcaption></figure><p>Now click on the “Advanced Editor” and open Power Query script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*WLSAGq8dvFqsj4bfPwPQ8A.png" /><figcaption>Power Query script view</figcaption></figure><p>Change the Source to point to main table (in our case Projects). This ensures that any future updates or modifications to the Projects table will automatically flow into the Errors table as well</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*9D9C_HzgYxXm72JDfzbJyQ.png" /><figcaption>Simplify Power Query</figcaption></figure><p>Now change the datatypes of all error columns to Text. This allows us to replace errors with custom text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*CS7WdQzd5aeIKtSC4zrB5Q.png" /><figcaption>Convert all non-text error columns to text columns</figcaption></figure><p>Use “Replace Errors” option to replace all errors with text “#Error”. You can do this column by column or use below script to replace all columns at once.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/0*MvwqBZ2_jyjvCS0V" /><figcaption>Replace errors with custom text</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*0Om0LPwfe4ClkYhKCn8xyQ.png" /><figcaption>Replace all columns with custom text</figcaption></figure><p>After you replace errors, your data will look like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cnv_IZviT6_b2XeEqBw8fQ.png" /><figcaption>After replacing errors with custom text</figcaption></figure><p>Here is the full script of “Projects_Errors” table</p><pre>let<br>    Source = Projects,<br>    #&quot;Kept Errors&quot; = Table.SelectRowsWithErrors(Source),<br>    #&quot;Changed Type&quot; = Table.TransformColumnTypes(#&quot;Kept Errors&quot;,{{&quot;Target Start&quot;, type text}, {&quot;Target Finish&quot;, type text}, {&quot;% Comp&quot;, type text}}),<br>    Columns = Table.ColumnNames(#&quot;Changed Type&quot;),<br>    #&quot;Replace Errors&quot; = Table.ReplaceErrorValues(#&quot;Changed Type&quot;, List.Transform(Columns, each {_, &quot;#Error&quot;}))<br>in<br>    #&quot;Replace Errors&quot;</pre><h4>Now let&#39;s get to the front end.</h4><p>Create a new tab in Power BI and add data from errors table. Add original columns for non-text fields. Your new table visual will look like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RuA6ZDahMQMr2XOdRy-Rig.png" /><figcaption>Create a new tab and add table visual</figcaption></figure><p>Rename non-text columns to remove Org suffix</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/259/1*FeN6dIRZv0O-_k3JJIpYZQ.png" /><figcaption>Remove suffix Org from column names</figcaption></figure><p>Final step! set background color for these non-text columns using error columns that we replaced with text “#Error”. This will visually differentiate error data from rest of the data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*Xj4eM0tvRfCqnr8ZH0FdCQ.png" /><figcaption>Conditional formatting to set the background color</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VwgwWwICNWVHG6fbqCDD0Q.png" /><figcaption>Set background color to org columns based on error columns</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y-EWOHFnO0tckxu2voa_8w.png" /><figcaption>User custom text “#Error” to set the color rule</figcaption></figure><h4>And you are done!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*6UN8MgMR3ZCJlH1mkd-80g.png" /><figcaption>Error data highlighted on the table visual</figcaption></figure><blockquote>Sample files can be downloaded from <a href="https://github.com/Enridge/blog/tree/aa709f2ffc4d246932c49bc2b9e0c55783476515/Power%20BI/Highlight%20Data%20Errors">here</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=487ef4feca1d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>