<?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 Hamidou Cherif on Medium]]></title>
        <description><![CDATA[Stories by Hamidou Cherif on Medium]]></description>
        <link>https://medium.com/@cherifal2011?source=rss-6519a3662616------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5KyWQvUq7O3u1Q9SlvaI0A.jpeg</url>
            <title>Stories by Hamidou Cherif on Medium</title>
            <link>https://medium.com/@cherifal2011?source=rss-6519a3662616------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 25 Nov 2026 01:53:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cherifal2011/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[Excel Formulas]]></title>
            <link>https://medium.com/@cherifal2011/excel-formulas-cfb9defbc797?source=rss-6519a3662616------2</link>
            <guid isPermaLink="false">https://medium.com/p/cfb9defbc797</guid>
            <category><![CDATA[excel-tutorial]]></category>
            <dc:creator><![CDATA[Hamidou Cherif]]></dc:creator>
            <pubDate>Wed, 10 Jun 2026 22:11:18 GMT</pubDate>
            <atom:updated>2026-06-10T22:11:18.591Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ybz5-LwFUEOW20n6L_k5AQ.jpeg" /></figure><p>The <a href="https://www.myonlinetraininghub.com/excel-if-statement-explained?awt_a=f2Zj&amp;awt_l=2jF6&amp;awt_m=irZrNqpxq5VR.Zj&amp;utm_source=aweber&amp;utm_medium=email&amp;utm_campaign=experienced-excel-users-are-replacing-if-with-these-functions">IF function</a> is one of the most useful functions in Excel, but it is also one of the most overused.</p><p>Because IF is so flexible, it often becomes the default solution for every type of decision, lookup, summary, or calculation. That can lead to long, complicated formulas that are hard to read, difficult to maintain, and easy to break.</p><p>For example, you might see formulas like this:</p><p>=IF(A2&gt;=90,”A”,<br> IF(A2&gt;=80,”B”,<br> IF(A2&gt;=70,”C”,<br> IF(A2&gt;=60,”D”,<br> “E”))))</p><p>This formula works, but IF is doing more than it should. In many cases, another Excel function can do the same job more clearly.</p><p>The issue is not that IF is bad. The issue is that IF is often used for jobs that other functions were designed to do better.</p><p>In this tutorial, we’ll look at six better alternatives to IF in Excel.</p><p>By the end, you’ll know when to use each one, and how to build formulas that are easier to read, easier to update, and more reliable.</p><h3><strong>Why You Should Avoid Overusing IF in Excel.</strong></h3><p>IF is designed to test a condition and return one result if the condition is true, and another result if it is false.</p><p>A simple IF formula looks like this:</p><p>=IF(A2&gt;=1000,”Target Met”,”Below Target”)</p><p>This is perfectly fine.</p><p>The problems start when IF is used for everything:</p><p>=IF(D6=”Unpaid”,”Chase Payment”,<br> IF(E6=”Out of Stock”,”Backorder”,<br> IF(F6&gt;7,”Expedite”,”Ship”)))</p><p>IF is designed to test a condition and return one result if the condition is true, and another result if it is false.</p><p>A simple IF formula looks like this:</p><p>=IF(A2&gt;=1000,”Target Met”,”Below Target”)</p><p>This is perfectly fine.</p><p>The problems start when IF is used for everything:</p><p>=IF(D6=”Unpaid”,”Chase Payment”,<br> IF(E6=”Out of Stock”,”Backorder”,<br> IF(F6&gt;7,”Expedite”,”Ship”)))</p><p>Again, this formula can work. But as the number of conditions grows, the formula becomes harder to follow. You have to manage multiple opening and closing brackets, keep the logic in the right order, and make sure every possible result is covered.</p><p>In other situations, IF gets used for tasks that are not really logical tests at all. For example:</p><p>• Looking up a commission rate from a region code</p><p>• Returning a result based on a dropdown selection</p><p>• Mapping month numbers to financial quarters</p><p>• Summing rows that meet multiple conditions</p><ul><li>Repeating the same calculation inside a longer formula.</li></ul><p><strong>Why You Should Avoid Overusing IF in Excel</strong></p><p>IF is designed to test a condition and return one result if the condition is true, and another result if it is false.</p><p>A simple IF formula looks like this:</p><p>=IF(A2&gt;=1000,”Target Met”,”Below Target”)</p><p>This is perfectly fine.</p><p>The problems start when IF is used for everything:</p><p>=IF(D6=”Unpaid”,”Chase Payment”,<br> IF(E6=”Out of Stock”,”Backorder”,<br> IF(F6&gt;7,”Expedite”,”Ship”)))</p><p>Again, this formula can work. But as the number of conditions grows, the formula becomes harder to follow. You have to manage multiple opening and closing brackets, keep the logic in the right order, and make sure every possible result is covered.</p><p>In other situations, IF gets used for tasks that are not really logical tests at all. For example:</p><p>• Looking up a commission rate from a region code</p><p>• Returning a result based on a dropdown selection</p><p>• Mapping month numbers to financial quarters</p><p>• Summing rows that meet multiple conditions</p><p>• Repeating the same calculation inside a longer formula</p><p>These are all common Excel tasks, but IF is often not the best function for them.</p><p><strong>1. Use IFS Instead of Nested IF for Multiple Conditions</strong></p><p>The <a href="https://www.myonlinetraininghub.com/excel-ifs-function?awt_a=f2Zj&amp;awt_l=2jF6&amp;awt_m=irZrNqpxq5VR.Zj&amp;utm_source=aweber&amp;utm_medium=email&amp;utm_campaign=experienced-excel-users-are-replacing-if-with-these-functions">IFS function</a> is the most obvious alternative to nested IF formulas.</p><p>It is useful when you have several conditions to test, and each condition returns a different result.</p><p>Imagine you have a list of sales orders, and each order needs a follow-up action. Some orders have not been paid. Some items are out of stock. Some deliveries will take too long. The remaining orders are ready to ship.</p><p>You could use a nested IF formula, but it gets harder to read as more conditions are added.</p><p>A cleaner option is IFS:</p><p>=IFS(<br> D6=”Unpaid”,”Chase Payment”,<br> E6=”Out of Stock”,”Backorder”,<br> F6&gt;7,”Expedite”,<br> TRUE,”Ship”<br> )</p><p>IFS works in pairs:</p><p>1. A condition to test</p><p>2. The result to return if that condition is true</p><p>Excel checks the conditions in order from top to bottom. The first condition that evaluates to TRUE wins.</p><p>In the above example, the formula checks:</p><p>1. Is the order unpaid? If yes, return “Chase Payment”.</p><p>2. Is the item out of stock? If yes, return “Backorder”.</p><p>3. Are delivery days greater than 7? If yes, return “Expedite”.</p><p>4. If none of those are true, return “Ship”.</p><p>The final TRUE, “Ship” acts like a default result. It catches anything that does not match the previous conditions.</p><p><strong>Why the Order Matters in IFS</strong></p><p>The order of conditions is important because IFS returns the first TRUE result.</p><p>In the order status example, unpaid orders should be flagged first. There is no point expediting an order that has not been paid for.</p><p>This is why the formula checks for unpaid orders before checking stock or delivery timing.</p><p>=IFS(<br> D6=”Unpaid”,”Chase Payment”,<br> E6=”Out of Stock”,”Backorder”,<br> F6&gt;7,”Expedite”,<br> TRUE,”Ship”<br> )</p><p><strong>IFS vs Nested IF</strong></p><p>IFS is usually easier to read than nested IF because each condition and result is listed in a simple sequence.</p><p>However, there is one important difference.</p><p><strong>IFS evaluates all conditions, even though it returns the first TRUE result. Nested IF formulas stop evaluating once they find the first TRUE result.</strong></p><p>In very large workbooks, nested IF may sometimes be more efficient. For most everyday formulas, IFS is easier to write and maintain.</p><p><strong>When to Use IFS</strong></p><p>Use IFS when:</p><p>• You have several conditions to check</p><p>• Each condition returns a different result</p><p>• The order of the conditions matters</p><p>• You want a cleaner alternative to nested IF</p><p>Avoid IFS when your formula is really trying to look up a value from a table. That is a job for XLOOKUP.</p><p><strong>2. Use XLOOKUP Instead of IF for Matching Values</strong></p><p>A common mistake is using IF to match one value to another.</p><p>For example, suppose you have region codes, and each region has a different commission rate.</p><p>You might be tempted to write a nested IF formula that says:</p><p>• If region is N, return this rate</p><p>• If region is S, return that rate</p><p>• If region is E, return another rate</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*B4_d275mYA5guMDusmT0Tg.png" /></figure><p>That works, but the rules are buried inside the formula. If a commission rate changes, you have to edit the formula. If a new region is added, the formula has to be rewritten.</p><p>This is not really a logic problem. It is a lookup problem.</p><p>A better solution is to store the region codes and commission rates in a small lookup table, then use the <a href="https://www.myonlinetraininghub.com/excel-xlookup-function?awt_a=f2Zj&amp;awt_l=2jF6&amp;awt_m=irZrNqpxq5VR.Zj&amp;utm_source=aweber&amp;utm_medium=email&amp;utm_campaign=experienced-excel-users-are-replacing-if-with-these-functions">XLOOKUP function</a>:</p><p>=XLOOKUP(D6,<br> CommRates[Region Code],<br> CommRates[Rate],<br> 0%)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*ylvyM4smLIVv1Pc-R-kMoQ.png" /></figure><p>Here’s what the formula does:</p><p>• D6 is the region code you want to look up.</p><p>• CommRates[Region Code] is where Excel should look for that region code.</p><p>• CommRates[Rate] is the column that contains the commission rate to return.</p><ul><li>0% is the value to return if the region code is not found.</li></ul><p>Now the commission rules are stored in a table instead of being hard-coded into the formula.</p><p><strong>Why XLOOKUP Is Better Than IF for Lookup Tables</strong></p><p>Using XLOOKUP makes the formula easier to maintain.</p><p>If the commission rate for South changes, you update the lookup table, not the formula.</p><p>If a new region is added, you add it to the table. If the lookup range is formatted as an Excel Table, the formula range expands automatically.</p><p><strong>When to Use XLOOKUP</strong></p><p>Use XLOOKUP when:</p><p>• You are matching one value to another</p><p>• Your formula is returning a value from a table</p><p>• Your rules may change over time</p><ul><li>You want the formula to be easier to maintain</li></ul><p>A simple rule is this:</p><p>If you are matching one item to another item, use a lookup table.</p><p><strong>3. Use SWITCH Instead of IF When Testing One Value</strong></p><h3>The SWITCH function is useful when you want to test one value and return different results depending on what that value is.</h3><p>For example, you might have a small report where the user chooses a metric from a dropdown list.</p><p>The dropdown might include:</p><p>• Total Sales</p><p>• Total Profit</p><p>• Profit Margin</p><ul><li>Average Selling Price</li></ul><p>You could use nested IF or IFS, but you would need to keep repeating the same test:</p><p>=IF(C15=”Total Sales”,…<br> IF(C15=”Total Profit”,…<br> IF(C15=”Profit Margin”,…<br> IF(C15=”Average Selling Price”,…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*92F9UipC_sxISDspZPenWg.png" /></figure><p>Repeating the same test is a clue that SWITCH may be cleaner.<br> Here is the SWITCH version:</p><p>=SWITCH(<br> C15,<br> “Total Sales”, SUM(D6:D9),<br> “Total Profit”, SUM(G6:G9),<br> “Profit Margin”, SUM(G6:G9)/SUM(D6:D9),<br> “Average Selling Price”, SUM(D6:D9)/SUM(F6:F9),<br> “Select a valid metric”<br> )</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*hXPuPUfQS45KTU2zlid9og.png" /></figure><p>With SWITCH, you only refer to C15 once.</p><p>The first argument is the value you want to test. Then you list each possible option, followed by the result to return.</p><p>So if C15 contains:</p><p>• Total Sales, Excel returns the sum of the Sales column.</p><ul><li>Total Profit, Excel returns the sum of the Profit column.</li></ul><p>• Profit Margin, Excel divides total profit by total sales.</p><ul><li>Average Selling Price, Excel divides total sales by units sold.</li></ul><p>The final argument is optional, but useful. It tells Excel what to return if none of the options match.</p><p>In this case, it returns:</p><p>“Select a valid metric”</p><p><strong>SWITCH vs XLOOKUP</strong></p><p>SWITCH and XLOOKUP can look similar because both can return different results based on an input.</p><p>The difference is that XLOOKUP retrieves a value from a table (or reference to a range), while SWITCH can return completely different calculations.</p><p>For example, XLOOKUP is ideal for returning a commission rate from a region code.</p><p>SWITCH is better when each option needs a different formula, such as:</p><p>“Total Sales”, SUM(D6:D9)</p><p>“Profit Margin”, SUM(G6:G9)/SUM(D6:D9)</p><p>Each option can return a different type of calculation.</p><p><strong>When to Use SWITCH</strong></p><p>Use SWITCH when:</p><ul><li>You are testing one value</li></ul><p>• There are several possible matches</p><p>• Each match returns a different result</p><p>• The same cell or value is repeated in a nested IF formula</p><p>• Each result may use a different calculation</p><p>SWITCH is especially useful for reports, dashboards, dropdown-driven summaries, and user-selected calculations.</p><p><strong>4. Use CHOOSE When a Number Represents a Position</strong></p><h3>The CHOOSE function is useful when you have a number that represents a position, and you want to return something based on that position.</h3><p>For example, suppose you have a month number in column D:</p><p>• Jan is 1</p><p>• Feb is 2</p><p>• Mar is 3</p><p>• And so on</p><p>Now suppose you want to return the financial year quarter, where the financial year starts in July.</p><p>The quarter mapping is different from a calendar year:</p><p>You could do this with nested IF, but the formula is really just mapping each month number to a quarter number:</p><p>You could do this with nested IF, but the formula is really just mapping each month number to a quarter number:</p><p>=IF(D6&lt;=3,”Q3&quot;,IF(D6&lt;=6,”Q4&quot;,IF(D6&lt;=9,”Q1&quot;,”Q2&quot;)))</p><p>That makes CHOOSE a good option:</p><p>=”Q”&amp;CHOOSE(D6,3,3,3,4,4,4,1,1,1,2,2,2)</p><p>The first argument, D6, tells Excel which item to choose.</p><p>The remaining arguments are the values for positions 1 through 12.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*W6DT1yu7R4lkrxL1FTDKqQ.png" /></figure><p>So if D6 contains:</p><p>• 1, Excel returns the first value, which is 3</p><p>• 2, Excel returns the second value, which is also 3</p><p>• 3, Excel returns the third value, again 3</p><p>• 7, Excel returns the seventh value, which is 1</p><p>Because the final result should display as Q1, Q2, Q3, or Q4, the formula adds “Q”&amp; at the start.</p><p>So CHOOSE returns the quarter number, and the formula adds the letter Q in front.</p><p><strong>4. Use CHOOSE When a Number Represents a Position</strong></p><p>The <a href="https://www.myonlinetraininghub.com/excel-choose-function?awt_a=f2Zj&amp;awt_l=2jF6&amp;awt_m=irZrNqpxq5VR.Zj&amp;utm_source=aweber&amp;utm_medium=email&amp;utm_campaign=experienced-excel-users-are-replacing-if-with-these-functions">CHOOSE function</a> is useful when you have a number that represents a position, and you want to return something based on that position.</p><p>For example, suppose you have a month number in column D:</p><p>• Jan is 1</p><p>• Feb is 2</p><p>• Mar is 3</p><p>• And so on</p><p>Now suppose you want to return the financial year quarter, where the financial year starts in July.</p><p>The quarter mapping is different from a calendar year:</p><p>You could do this with nested IF, but the formula is really just mapping each month number to a quarter number:</p><p>You could do this with nested IF, but the formula is really just mapping each month number to a quarter number:</p><p>=IF(D6&lt;=3,”Q3&quot;,IF(D6&lt;=6,”Q4&quot;,IF(D6&lt;=9,”Q1&quot;,”Q2&quot;)))</p><p>That makes CHOOSE a good option:</p><p>=”Q”&amp;CHOOSE(D6,3,3,3,4,4,4,1,1,1,2,2,2)</p><p>The first argument, D6, tells Excel which item to choose.</p><p>The remaining arguments are the values for positions 1 through 12.</p><p>So if D6 contains:</p><p>• 1, Excel returns the first value, which is 3</p><p>• 2, Excel returns the second value, which is also 3</p><p>• 3, Excel returns the third value, again 3</p><p>• 7, Excel returns the seventh value, which is 1</p><p>Because the final result should display as Q1, Q2, Q3, or Q4, the formula adds “Q”&amp; at the start.</p><p>So CHOOSE returns the quarter number, and the formula adds the letter Q in front.</p><p><strong>Why CHOOSE Works Well Here</strong></p><p>CHOOSE is a good fit because the input is already a number from 1 to 12, and each number has a specific result.</p><p>The month number acts like a position.</p><p>Instead of testing each month one by one, CHOOSE simply says:</p><p>“Take the number in D6 and return the matching item from this list.”</p><p><strong>When to Use CHOOSE</strong></p><p>Use CHOOSE when:</p><p>• The input is a number</p><p>• The number represents a position</p><p>• Each position maps to a known result</p><p>• You want a compact alternative to multiple IF statements</p><p>CHOOSE is useful for month mappings, scenario selections, index-based labels, and simple numbered categories.</p><p><strong>. Use SUMIFS and COUNTIFS Instead of IF Helper Columns</strong></p><p>So far, the examples have returned a result for each individual row.</p><p>But sometimes you do not need a row-by-row result. You just need to answer a summary question.</p><p>For example, suppose you have the following sales table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*qYRMW68P9SYdbfC1qlYdKA.png" /></figure><p>And you want to answer these questions:</p><p>1. How much revenue came from closed deals in the North region?</p><p>2. How many closed North deals are there?</p><p>A common approach is to create a helper column with IF:</p><p>=IF(AND(D6=”North”,E6=”Closed”),F6,0)</p><p>This checks each row:</p><p>• If the region is North and the status is Closed, return the revenue.</p><p>• Otherwise, return zero.</p><p>Then you would sum the helper column:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*agzN1AfGSJsMILml8YnQxA.png" /></figure><p>That works, but it is the long way around. You do not actually need a row-by-row result. You only need the final total.</p><p>That is exactly what <a href="https://www.myonlinetraininghub.com/excel-sumif-and-sumifs-formulas-explained?awt_a=f2Zj&amp;awt_l=2jF6&amp;awt_m=irZrNqpxq5VR.Zj&amp;utm_source=aweber&amp;utm_medium=email&amp;utm_campaign=experienced-excel-users-are-replacing-if-with-these-functions">SUMIFS</a> is designed for.</p><p><strong>Use SUMIFS to Sum Values That Meet Conditions</strong></p><p>SUMIFS adds values that meet one or more conditions.</p><p>=SUMIFS(F6:F11,<br> D6:D11,”North”,<br> E6:E11,”Closed”)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*Tzxmlsf9ySotjM1INDSvVQ.png" /></figure><p>Here’s how it works:</p><p>• F6:F11 is the range to add.</p><p>• D6:D11,”North” checks whether the region is North.</p><ul><li>E6:E11,”Closed” checks whether the status is Closed.</li></ul><p>The formula filters the rows and sums the matching revenue in one step.</p><p>No helper column required.</p><p><strong>Use COUNTIFS to Count Rows That Meet Conditions</strong></p><p>For the second question, you want to count how many closed North deals there are.</p><p>That is where COUNTIFS comes in:</p><p>=COUNTIFS(<br> D6:D11,”North”,<br> E6:E11,”Closed”)</p><p><a href="https://www.myonlinetraininghub.com/excel-countif-and-countifs-formulas-explained?awt_a=f2Zj&amp;awt_l=2jF6&amp;awt_m=irZrNqpxq5VR.Zj&amp;utm_source=aweber&amp;utm_medium=email&amp;utm_campaign=experienced-excel-users-are-replacing-if-with-these-functions">COUNTIFS</a> uses the same criteria structure as SUMIFS, but it counts matching rows instead of adding values.</p><p>In this example, it counts rows where:</p><p>• Region is North</p><p>• Status is Closed</p><p><strong>When to Use SUMIFS and COUNTIFS</strong></p><p>Use SUMIFS or COUNTIFS when:</p><p>• You need a single summary result</p><p>• You are applying one or more conditions</p><p>• You do not need a helper column</p><p>• You are building reports or dashboards</p><ul><li>You want a formula that summarises the dataset directly.</li></ul><p>These functions are especially useful for management reports, KPI dashboards, sales summaries, and financial analysis.</p><p><strong>. Use LET to Simplify Repeated Calculations</strong></p><p>Sometimes the problem is not the IF function itself. The problem is that the formula repeats the same calculation multiple times.</p><h3>That is where the LET function can help.</h3><p>LET allows you to name part of a formula, then reuse that name later in the same formula.</p><p>This can make formulas easier to read, easier to maintain, and more efficient.</p><p><strong>Example: Commission Based on Net Sales</strong></p><p>Suppose you are calculating commission based on net sales.</p><p>Net sales are calculated as:</p><p>Sales less discount</p><p>The commission is only paid if net sales meet or exceed the target.</p><p>A standard IF formula might look like this:</p><p>=IF(D6*(1-E6)&gt;=F6,D6*(1-E6)*5%,0)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/853/1*LKJgj_iYCQUDUaukbHSRgA.png" /></figure><p>This works, but the same calculation appears twice:</p><p>D6*(1-E6)</p><p>That is the net sales calculation.</p><p>The formula uses it once to test whether the target was met, and again to calculate the commission.</p><p>In a small formula, that might not seem like a major problem. In a real workbook, repeated calculations can be longer, harder to check, and copied down thousands of rows.</p><p><strong>Use LET to Name the Repeated Calculation</strong></p><p>Here is the LET version:</p><p>=LET(<br> netSales,D6*(1-E6),<br> IF(netSales&gt;=F6,netSales*5%,0))</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*kuQqjY-iGWpiwDAsCEp2BQ.png" /></figure><p>This formula creates a name called netSales.</p><p>Then it defines what netSales means:</p><p>D6*(1-E6)</p><p>Now that name can be used in the IF formula:</p><p>IF(netSales&gt;=F6,netSales*5%,0)</p><p>The logical test becomes:</p><p>netSales&gt;=F6</p><p>The result if TRUE becomes:</p><p>netSales*5%</p><p>And if the target was not met, the formula returns zero.</p><p><strong>Why LET Makes Formulas Better</strong></p><p>LET improves the formula in three ways.</p><p>First, the net sales calculation only appears once.</p><p>Second, the formula is easier to read because netSales explains what the calculation represents.</p><p>Third, if the net sales logic changes, you edit it in one place.</p><p>This is especially useful in formulas that contain repeated logic, intermediate calculations, or complex expressions.</p><p><strong>When to Use LET</strong></p><p>Use LET when:</p><ul><li>The same calculation appears more than once.</li></ul><p>• A formula is getting hard to read</p><p>• You want to name intermediate results</p><p>• You want to improve formula maintainability</p><p>• You want to reduce repeated calculations</p><p>LET does not replace IF. It works with IF and other functions to make formulas cleaner.</p><p><strong>When Should You Still Use IF?</strong></p><p>IF is still the right choice when you have a straightforward logical test.</p><p>For example:</p><p>=IF(B2&gt;=1000,”Target Met”,”Below Target”)</p><p><strong>Hamidou Cherif</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cfb9defbc797" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Merging two data sources in Power BI.]]></title>
            <link>https://medium.com/@cherifal2011/merging-two-data-sources-in-power-bi-66e2429c4fbe?source=rss-6519a3662616------2</link>
            <guid isPermaLink="false">https://medium.com/p/66e2429c4fbe</guid>
            <category><![CDATA[power-bi-tutorials]]></category>
            <dc:creator><![CDATA[Hamidou Cherif]]></dc:creator>
            <pubDate>Thu, 14 Nov 2024 01:54:18 GMT</pubDate>
            <atom:updated>2024-11-14T01:54:18.675Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*pbD8YgMAB9h6-mThAHXqGQ.jpeg" /></figure><h3><strong>Overview</strong></h3><p>In the exercise <em>Merging two data sources, </em>I put into practice my understanding of how to merge two data sources and by importing, merging and choosing join kind in Power Query.</p><p>My objective in this exercise was to merge data sources by completing the following tasks:</p><ul><li>Download CSV Files</li><li>Open <em>Power Query Editor</em></li><li>Choose Queries</li><li>Merge Queries</li><li>Select Column(s) from <em>Product</em></li><li>Choose and reorder columns from <em>Sales</em></li></ul><p>This reading provides a step-by-step guide for completing these tasks, accompanied by screenshots for comparison with my own copy.</p><p><strong>Step 1: Download CSV files</strong></p><ul><li>Download <em>Sales.csv </em>and <em>Product.csv</em><strong> </strong>files.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cyAlmRBIFyBE2IlipIBETg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*H8Zpfra9_cgV5RjrsK6ERQ.png" /></figure><p><strong>Step 2: Create a Power BI project</strong></p><ol><li>Create a Power BI project and open the Power Query editor.</li><li>Create a new Power BI project called <em>Merging two tables</em>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*3I1LWFYPnhJWkZkeNHAoHw.png" /></figure><p><strong>Step 3: Open the Power Query Editor</strong></p><p>Import your datasets, <em>Sales </em>and <em>Product</em>.</p><ol><li>Select the <strong>Text/CSV </strong>option from <strong>Get Data </strong>menu, in the <strong>Data </strong>group when the <strong>Home </strong>ribbon tab is selected.</li><li>Select the <em>Sales.csv</em> file and then select <strong>Transform Data</strong> in the window that opened.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*QdFKjYD-kpj9g5dPMjJwJw.png" /></figure><p>3. The Power Query Editor<em> </em>window opens. I can now select the queries that I want to merge.</p><p>4. In Power Query Editor<em> </em>with the <strong>Home </strong>ribbon selected, select the <strong>New Source </strong>menu in the<strong> New Query </strong>group and choose<strong> Text/CSV</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/266/1*Fe6r3NJSBaM4sF3MPZJl4Q.png" /></figure><p>5. Select <em>Product.csv </em>and then select <strong>OK</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*S_FjAN6lxqNRoBf8FafMFA.png" /></figure><p><strong>Step 4: Merge queries</strong></p><p>Merge the <em>Sales </em>and <em>Product </em>queries, using <strong>Left Outer Join </strong>in the common column <strong>ProductKey</strong>.</p><ol><li>After selecting the <strong>Sales </strong>data in the <strong>Queries </strong>pane, under the <strong>Home </strong>ribbon, click <strong>Merge Queries</strong> in the <strong>Combine </strong>group.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/281/1*-c_rT_LEtPBR-kuxc4O9ZQ.png" /></figure><p>2. Choose <strong>Merge Queries</strong> inside the <strong>Merge Queries</strong> dropdown menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*YM1QS3HqJGQl7GV1R7Vhsg.png" /></figure><p>3. In the opened window, the <em>Sales</em> table will be automatically shown in the upper parts choose <em>Product </em>in the dropdown and click <strong>ProductKey</strong> columns in each table to mark the common column between the tables.</p><p>4. For the <strong>Join Kind</strong> dropdown, choose the <strong>Left Outer Join</strong> which selects all records from the left table and matching records from the right table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*h1JrmRVjrFhVZJVHkJ_icQ.png" /></figure><p><strong>Step 5: Select column(s) from Product</strong></p><p>After I merge the tables, a new column, named <strong>Product, </strong>is added to the right side of the <em>Sales </em>table, which allows me to choose columns from the <em>Product </em>table.</p><ol><li>Find the column named <strong>Product </strong>at the most right of the table and click on the expand button to the right of the column.</li></ol><p>Choose the <strong>Product </strong>column by clicking on it and deselecting any other columns. Note, the <strong>Product </strong>query and column have the same names, so make sure you don’t get confused.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*Y8YAwJ58cw2xoHWatREZ3A.png" /></figure><p>3. Rename <strong>Product.Product </strong>column to <strong>Product.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*Lv5omWA79GahATDX1MDEIw.png" /></figure><p><strong>Step 6: Choose and reorder columns from Sales</strong></p><p>Reorder the columns from the <em>Sales </em>table after merging them with <em>Product </em>table.</p><ol><li>My manager asked me to show the name of the product, so I won’t need the key anymore. I remove <strong>ProductKey </strong>column by right clicking on the column and select <strong>Remove</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*II60FV3rHsHKrcGA5iG88g.png" /></figure><p>2. I move the newly added <strong>Product </strong>column<strong> </strong>between <strong>OrderDate </strong>and <strong>Quantity </strong>columns by dragging and dropping them in place.</p><p>3. Remove <strong>Reseller</strong>, <strong>Employee </strong>and <strong>Sales Territory Key </strong>columns from the query.</p><p>4. My final query will look like the image below after I have renamed, removed and reordered columns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*ZzWTct100IIEPB15bnMp_g.png" /></figure><h3><strong>Conclusion</strong></h3><p>My objective for this exercise was to apply techniques for importing, formatting, and merging data. In this context, you learned how to use Power Query Editor to import more than one data source, merge them by using the common columns, choose the columns from both tables and format the columns as needed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66e2429c4fbe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Apply a pivot In Power Query.]]></title>
            <link>https://medium.com/@cherifal2011/apply-a-pivot-in-power-query-4aa6c5ecd277?source=rss-6519a3662616------2</link>
            <guid isPermaLink="false">https://medium.com/p/4aa6c5ecd277</guid>
            <category><![CDATA[power-bi]]></category>
            <dc:creator><![CDATA[Hamidou Cherif]]></dc:creator>
            <pubDate>Tue, 12 Nov 2024 01:29:52 GMT</pubDate>
            <atom:updated>2024-11-12T01:29:52.026Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*pbD8YgMAB9h6-mThAHXqGQ.jpeg" /></figure><p>In this activity, you will convert a Cherifal Works Excel file called <em>Product-Color Model.xlsx </em>that includes Product ID, Color, and Model data. You need to present the product count per color in a tabular format. To do this, you need to import the Excel data first and then pivot columns by using aggregate functions. Follow the steps below to apply a pivot in Power BI.</p><p><strong>Step 1: Select the data source type</strong></p><ol><li>Open <strong>Power BI Desktop</strong>.</li><li>On the Home ribbon tab, inside the Data group, select the <strong>Get Data </strong>down arrow followed by <strong>Excel</strong> to find <em>Product-Color Model.xlsx.</em></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*V3BWIo97DfGXxa_T-wsDuw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*NFdRBzO1Lf8oQPGwgP1S9w.png" /></figure><p><strong>Step 2: Import Excel data</strong></p><ol><li>Import the <strong>Excel data</strong> to add the <strong>Product-Color</strong> <strong>Model </strong>query to the Queries pane.</li><li>Observe the 3 columns in the table: <strong>Product Name, Color </strong>and <strong>Model</strong>.</li><li>Remove the<strong> Product Name</strong> column. <strong>Note: </strong>Because your objective is to present the product count by color, you do not need this column.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*tNa_3JqB7CgIJdQN86l0nw.png" /></figure><p><strong>Step 3: Pivot columns</strong></p><ol><li>To pivot the table columns, select the <strong>Product-Color Model</strong> query on the left menu.</li><li>Select the <strong>Transform ribbon</strong> tab, followed by <strong>Pivot Column</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*8IYV2ygxsqg_l9luoYJhdg.png" /></figure><ol><li>On the <strong>Pivot Column</strong> window that displays, select the <strong>Color </strong>column in the query and keep the value in <strong>Values </strong>column dropdown list.</li><li>Expand the <strong>Advanced options</strong> and select option <strong>Count (All)</strong> from the <strong>Aggregate Value Function </strong>dropdown list, and then select <strong>OK</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*I4ESreJK85mhdkgIhvNBHw.png" /></figure><p><strong>Note: Count </strong>is an aggregate function and <strong>Count (All) </strong>counts every row and returns an integer value. Generally, it’s recommended to use <strong>Count </strong>as the aggregate function. In some cases, you may use <strong>SUM</strong>, which calculates the summation of all the rows. MIN, MAX or AVG functions are rarely used.</p><p><strong>Step 4: Examine the changes</strong></p><p>By applying the <strong>Pivot Column</strong>, you change the way the data is organized. All distinct color values are converted to the column headers. There is just one row in the table, where every column has a matching count of that category in the previous rows. You can use this data to visualize in reports or dashboards, primarily in pie chart reports.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*ElTVU-SoDjF5HW-2pNRVug.png" /></figure><p><strong>Conclusion</strong></p><p>In this step-by-step activity, you practiced applying a pivot operation in Power BI, an important operation especially when working with Excel data. You observed that the pivot operation converts row values to columns and sets aggregate function results for the column rows. Remember that both pivoting and unpivoting operations are useful where you need rows converted to columns and columns converted to rows respectively. Now that you’ve applied the pivoting technique, you’re better prepared to use them in a data analysis task.</p><p>Give me Like.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4aa6c5ecd277" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Preparing a dataset In Power Query.]]></title>
            <link>https://medium.com/@cherifal2011/preparing-a-dataset-in-power-query-9876c9b52a12?source=rss-6519a3662616------2</link>
            <guid isPermaLink="false">https://medium.com/p/9876c9b52a12</guid>
            <category><![CDATA[power-bi]]></category>
            <dc:creator><![CDATA[Hamidou Cherif]]></dc:creator>
            <pubDate>Tue, 12 Nov 2024 00:30:44 GMT</pubDate>
            <atom:updated>2024-11-12T00:30:44.204Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*pbD8YgMAB9h6-mThAHXqGQ.jpeg" /></figure><p><strong>Introduction</strong></p><p>In the exercise <em>Preparing a data set,</em> you put into practice your understanding of how to prepare a data set by importing, cleaning, and transforming data in Power Query.</p><p>Your objective in this exercise was to prepare a worksheet for analysis by completing the following tasks:</p><ul><li>Address instances of missing values.</li><li>Clean columns by changing data types as required.</li><li>Replace values where required.</li><li>Address inconsistencies in data.</li><li>And drop records with errors.</li></ul><p><strong>Step 1: Load the workbook</strong></p><p><em>Import your dataset.</em></p><ol><li>At the top of the <strong>Power BI</strong> window, navigate to the <strong>Home</strong> ribbon tab.</li><li>In the <strong>Data</strong> group, select the <strong>Get Data</strong> option. Select the data source to import.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*m10XcXpKnRRidsgGWFk2Ew.png" /></figure><p><strong>Step 2: Open the Power Query editor</strong></p><p><em>Open the Power Query editor to begin editing your data.</em></p><ol><li>In the <strong>Queries</strong> group, select the <strong>Transform Data</strong> button. It’s located in the middle of the toolbar.</li><li>The <strong>Power Query Editor</strong> window opens. You can now begin cleaning the data.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*ScwUG9ToJK4Tq8V_Iy_GHw.png" /></figure><p><strong>Step 3: Address missing values</strong></p><p><em>Locate and select the </em><strong><em>Units Sold</em></strong><em> column. Identify all </em><strong><em>NULL </em></strong><em>values within the column and replace them with a value of </em><strong><em>0</em></strong><em>. Repeat this task for the </em><strong><em>Sale Price</em></strong><em>, </em><strong><em>Sales</em></strong><em>, and </em><strong><em>Profit</em></strong><em> columns.</em></p><ol><li>In the <strong>Power Query Editor</strong>, locate the <strong>Units Sold</strong> column in the dataset preview.</li><li>Select the header of the <strong>Units Sold</strong> column to highlight it.</li><li>In the <strong>Home</strong> tab at the top of the window, select the <strong>Replace Values</strong> button.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*z7_aBUMnvNZb9jUBb6AvrQ.png" /></figure><ol><li>In the <strong>Replace Values</strong> window that appears, type <strong>null </strong>in the <strong>Value to Find</strong> field (indicating missing values) and type <strong>0</strong> in the <strong>Replace With </strong>field.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*nMaSU3fHxjGN6r2gEVLLwg.png" /></figure><ol><li>Select the <strong>OK</strong> button to replace all missing values in the <strong>Units Sold</strong> column with <strong>0</strong>.</li><li>Now, select the down arrow near the <strong>Units Sold</strong> column and confirm that no <strong>NULL </strong>values remain in the column. By performing this operation, you have replaced the non-numeric value <strong>NULL </strong>with the numeric value <strong>0</strong> in the <strong>Units Sold</strong> rows.</li><li>Repeat these steps for the <strong>Sale Price</strong>, <strong>Sales</strong>, and <strong>Profit</strong> columns.</li></ol><p><strong>Step 4: Clean the Manufacturing Price and Sale Price columns</strong></p><p><em>Locate and select the </em><strong><em>Manufacturing Price</em></strong><em> and </em><strong><em>Sale Price</em></strong><em> columns. Change the data type for both columns to </em><strong><em>Decimal Number</em></strong><em>.</em></p><ol><li>Highlight the <strong>Manufacturing Price</strong> column by selecting its header.</li><li>Change the data type of the <strong>Manufacturing Price</strong> column to <strong>Decimal Number</strong> by selecting the data type icon next to the column name (it may initially show as <strong>ABC</strong> or <strong>123</strong>) and choosing <strong>Decimal Number</strong> from the drop-down menu.</li><li>Take note of how the appearance of the <strong>Manufacturing Price</strong> column values has changed.</li><li>Repeat this task for the <strong>Sale Price</strong>, <strong>Sales</strong>, and <strong>Profit</strong> columns.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*mHDcvvW_cHSPduC6dnM5cg.png" /></figure><p><strong>Step 5: Clean the Discount Band column</strong></p><p><em>Select the </em><strong><em>Discount Band</em></strong><em> column. Locate each instance of value </em><strong><em>1</em></strong><em> in the column. Replace each instance of this value with </em><strong><em>None</em></strong><em>. Then change the data type of the column to </em><strong><em>Text</em></strong><em>.</em></p><ol><li>Highlight the <strong>Discount Band</strong> column by selecting its header.</li><li>Select the <strong>Replace Values</strong> button in the <strong>Home</strong> ribbon tab.</li><li>In the <strong>Replace Values</strong> window, enter <strong>1</strong> in the <strong>Value to Find</strong> field and <strong>None</strong> in the <strong>Replace With</strong> field.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*ogS1GVWsx4KMyImcHezKoQ.png" /></figure><ol><li>Select the <strong>OK</strong> button to replace the incorrect entry with <strong>None</strong>.</li><li>Select the down arrow near the <strong>Discount Band</strong> column and confirm that the <strong>None </strong>value is added to the value list.</li><li>Change the data type of the <strong>Discount Band</strong> column to <strong>Text</strong> by selecting the data type icon next to the column name (it may initially show as <strong>ABC</strong> or <strong>123</strong>) and choosing <strong>Text</strong> from the drop-down menu.</li><li>Take note of how the appearance of the <strong>Discount Band</strong> column values has changed.</li></ol><p><strong>Step 6: Clean the Units Sold column</strong></p><p><em>Select the </em><strong><em>Units Sold</em></strong><em> column. Search for and locate all instances of the text value </em><strong><em>six hundred</em></strong><em>. Replace each instance of this text value with the numerical value </em><strong><em>600</em></strong><em>. Then change the column’s data type to </em><strong><em>Whole Number</em></strong><em>.</em></p><ol><li>Highlight the <strong>Units Sold</strong> column by selecting its header.</li><li>On the <strong>Home</strong> tab, select the <strong>Replace Values</strong> button.</li><li>In the <strong>Replace Values</strong> window, enter <strong>six hundred </strong>(the text value to be replaced) in the <strong>Value to Find</strong> field and <strong>600 </strong>(the new numeric value) in the <strong>Replace With</strong> field.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*WCiitM5AVvlpgxo0QUQBNA.png" /></figure><ol><li>Select the <strong>OK</strong> button to replace the text entry with the numerical value. By performing this operation, you have replaced another non-numeric value of <strong>six hundred </strong>with a numeric value of <strong>600 </strong>in the <strong>Units Sold</strong> rows. Now you are ready to change the column’s data type.</li><li>Change the data type of the <strong>Units Sold</strong> column to <strong>Whole Number</strong> by selecting the data type icon next to the column name (it may initially show as <strong>ABC </strong>or <strong>123</strong>) and choosing <strong>Whole Number</strong> from the drop-down menu.</li><li>Take note of how the appearance of the <strong>Units Sold</strong> column values has changed.</li></ol><p><strong>Step 7: Address inconsistencies in the Date column</strong></p><p><em>Select the </em><strong><em>Date</em></strong><em> column. Change the column’s data type to </em><strong><em>Date</em></strong><em>. The column also contains several empty values. Replace all empty values with the default date of </em><strong><em>03 March 2023</em></strong><em>. Next, select the </em><strong><em>Month Number</em></strong><em> column. Change the column’s data type to </em><strong><em>Whole Number</em></strong><em>.</em></p><ol><li>Highlight the <strong>Date</strong> column by selecting its header.</li><li>Change the data type of the <strong>Date</strong> column to the <strong>Date </strong>data type by selecting the data type icon next to the column name (it may initially show as <strong>ABC</strong> or <strong>123</strong>) and choosing the <strong>Date </strong>option from the drop-down menu.</li><li>Replace any empty values with a default date (of <strong>03 March 2023</strong>) using the <strong>Replace Values</strong> tool.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*u3881nJx3DZ4E-AKAhFlbA.png" /></figure><ol><li>Next, select the down arrow near the <strong>Month Number</strong> column. Confirm that there are no empty values and that the <strong>03 March 2023</strong> value is added to the value list.</li><li>Highlight the <strong>Month Number</strong> column by selecting its header.</li><li>Change the data type of the <strong>Month Number</strong> column to <strong>Whole Number</strong> by selecting the data type icon next to the column name (it may initially show as <strong>ABC</strong> or <strong>123</strong>) and choosing <strong>Whole Number</strong> from the drop-down menu.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*Pzf7IgbxwwBuosFS4_MTYA.png" /></figure><ol><li>Take note of how the appearance of the <strong>Month Number</strong> column values has changed.</li></ol><p><strong>Step 8: Drop records with errors</strong></p><p><em>Select the </em><strong><em>Manufacturing Price</em></strong><em> column. The column contains errors in rows </em><strong><em>6 </em></strong><em>and </em><strong><em>38</em></strong><em>. Use the </em><strong><em>Remove Errors</em></strong><em> feature to drop these records. Repeat the same steps for the errors in the </em><strong><em>Sales</em></strong><em> and </em><strong><em>Profit</em></strong><em> columns.</em></p><ol><li>Examine each column individually to identify any columns that may have errors. There is an error in the <strong>Manufacturing Price</strong> column. Select the column header to select it.</li><li>With the column selected, navigate to the <strong>Home </strong>tab on the Ribbon.</li><li>Locate the <strong>Remove Rows</strong> button. Select the button to reveal a drop-down menu.</li><li>In the drop-down menu, choose <strong>Remove Errors</strong>. Power Query scans the selected column and removes all rows it identifies within the column that contain errors.</li><li>Confirm that no errors remain on any rows in the <strong>Manufacturing Price</strong> column.</li><li>Repeat these steps for the <strong>Sales</strong> and <strong>Profit</strong> columns.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*FUSrFokeRh-L9iM38MhHyA.png" /></figure><p><strong>Step 9: Drop duplicate rows</strong></p><p><em>The dataset contains several duplicate rows. Remove these duplicate rows from the dataset.</em></p><ol><li>In the Power Query Editor, locate the <strong>Queries</strong> pane on the left side of the window. Select the table name.</li><li>In the <strong>Home </strong>tab, locate the <strong>Remove Rows</strong> button in the toolbar. Select the button to reveal a drop-down menu.</li><li>In the drop-down menu, choose <strong>Remove Duplicates</strong>. Power Query scans your dataset and automatically removes any duplicate rows it identifies.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*4momrE5TqoxJdTDpaTl1Ug.png" /></figure><p><strong>Step 10: Apply the data transformations</strong></p><p><em>Once you have completed all the above data cleaning steps, select the </em><strong><em>Close &amp; Apply</em></strong><em> button to apply your transformations and update the dataset.</em></p><ol><li>Once you have completed all the data cleaning steps outlined above, in the top-left corner of the <strong>Power Query Editor</strong> window, select the <strong>Close &amp; Apply</strong> button. This action applies all the transformations you have made and closes the Power Query Editor.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*n5uzBUKIoVD0vay6-BmoSA.png" /><figcaption>1. Power BI Desktop updates the dataset in the <strong>Data</strong> view with the cleaned, transformed data.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*sp8-k68f7SmdQxeW--aUWg.png" /></figure><p><strong>Conclusion</strong></p><p>Your objective for this exercise was to apply techniques for importing, cleaning, and transforming data. In this context, you learned how to use Power Query Editor to change data types, replace missing or inconsistent values, remove duplicate rows, and eliminate rows with errors.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9876c9b52a12" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implementing triggers In Power BI.]]></title>
            <link>https://medium.com/@cherifal2011/implementing-triggers-in-power-bi-b8495bbcf855?source=rss-6519a3662616------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8495bbcf855</guid>
            <category><![CDATA[power-bi-tutorials]]></category>
            <dc:creator><![CDATA[Hamidou Cherif]]></dc:creator>
            <pubDate>Fri, 08 Nov 2024 01:56:17 GMT</pubDate>
            <atom:updated>2024-11-08T01:56:17.691Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*pbD8YgMAB9h6-mThAHXqGQ.jpeg" /></figure><h3><strong>Introduction</strong></h3><p>Manually importing and analyzing data can be tedious and time-consuming, which is why Power BI offers Triggers and Connectors to automate workflows and save you time.</p><p>Triggers are an essential functionality in Power BI that allow you to automate tasks based on specific conditions. By configuring a trigger, you can schedule an action to execute at a particular time or when a particular event occurs. Connectors play a vital role in Power BI by connecting to various data sources and executing actions or triggering workflows based on specific events, saving time and improving the accuracy of your business data.</p><p>In this exercise, you will learn how to configure a connector and set up a trigger in Power BI to create a dataset (a collection of data that has been imported, transformed, and loaded into the Power BI service) that is updated each night at the same time from a local Excel file. By the end of this exercise, you will be able to automate tasks and actions to deliver fast, accurate data to meet specific business requirements.</p><h3><strong>Case study</strong></h3><p>Your manager, Cherif Quinn, a data analyst at Coffee Inc, has tasked you with analyzing daily sales reports and providing insights to the management team. However, manually importing and analyzing the data can be time-consuming and tedious.</p><p>To automate the process, you want to use Power BI’s triggers and actions to configure the workflow. With Power BI, you can easily schedule an action to refresh the data, freeing up time to focus on analyzing the data and providing valuable insights to the management team.</p><h3><strong>Instructions</strong></h3><h3><strong>Step 1: Prepare the resources</strong></h3><ol><li>Prepare data in Excel Let’s take an Excel file as an example. Download this sample data set and save it to your computer or to OneDrive for Business.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_1PyUwyhnQjOTuOW4tqW1g.png" /></figure><p>Before you can load your Excel file into Power BI, you must organize your data in a flat table. In a flat table, each column contains the same data type; for example, text, date, number, or currency. Your table should have a header row but no columns or rows that display totals. Next, format your data as a table. In Excel, on the <strong>Home</strong> tab, in the <strong>Styles </strong>group, select <strong>Format as Table</strong>.</p><h3><strong>Step 2: Get the data to the Power BI service.</strong></h3><p>Once you have the resources ready, you can proceed to select data. The Power BI service connects to many data sources, including Excel files. You can use the <strong>Get data</strong> option to import or connect to an Excel workbook. From the File menu, select the location of your file.</p><p>The sales department at Adventure Works uploads the file every day to the company’s OneDrive, so the location you should choose is OneDrive — Business. After uploading your workbook, it will be available in the Workbooks section of the workspace’s navigation pane and in the workspace’s content list. This action will add a dataset, and the report can be generated and published.</p><p>These are the steps to follow:</p><ol><li>Launch Power BI.</li><li>Get data to import or connect.</li><li>Specify location of file.</li><li>Load to create a dataset.</li></ol><p>These steps will guide you to get data ready for an automated refresh.</p><h3><strong>Step 3: Configure a trigger</strong></h3><p>To schedule updates for your dataset in Power BI Service, you’ll need to set up a trigger.</p><ol><li>Start by selecting the dataset you want to configure. You can do this by navigating to the <strong>Datasets</strong> tab of the left sidebar and clicking on the dataset you want to work with.</li><li>Once you’ve selected your dataset, choose a function to schedule a refresh. You’ll have the option to schedule a regular refresh, or to set up an incremental refresh.</li><li>After selecting your function, you’ll need to configure the parameters. This will depend on the function you’ve chosen, but common parameters include the refresh frequency and the start time for the refresh. Finally, apply the trigger to your dataset. You can do this by selecting <strong>Apply</strong> in the trigger configuration panel.</li></ol><h3><strong>Conclusion</strong></h3><p>Learning how to configure triggers and connectors in Power BI can help you automate repetitive tasks, reduce the time spent on manual data entry, and improve the accuracy of your data. This exercise demonstrated how to set up a time-based trigger to automate the process of importing data from a local Excel file into a Power BI dataset. By following the steps provided, you can create a workflow that automatically updates the dataset at a specific time on schedule. This will allow you to focus on analyzing the data and providing valuable insights to your team at Adventure Works, without having to worry about the tedious and time-consuming task of manually importing and analyzing the data.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8495bbcf855" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is published a report in Power Bi?]]></title>
            <link>https://medium.com/@cherifal2011/what-is-published-a-report-in-power-bi-be0330077aab?source=rss-6519a3662616------2</link>
            <guid isPermaLink="false">https://medium.com/p/be0330077aab</guid>
            <dc:creator><![CDATA[Hamidou Cherif]]></dc:creator>
            <pubDate>Fri, 21 Jun 2024 03:31:18 GMT</pubDate>
            <atom:updated>2024-06-21T03:31:18.535Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*pbD8YgMAB9h6-mThAHXqGQ.jpeg" /></figure><h3>Introduction</h3><p>Microsoft Power BI is a flexible business intelligence system with various parts, including Power BI Desktop for data import, preparation, report creation, and visualization. Additionally, it allows for the sharing of reports after they are created. In this reading, you’ll explore an overview of Power BI reports and discover what is shared during publication.</p><h3>Power BI reports</h3><p>In Power BI, you create reports to visualize and share insights. Since Power BI Desktop can’t be installed on various devices like mobiles and tablets, you need a place to host your reports for sharing, as Power BI users work with data from many different sources and devices.</p><p>Power BI provides two hosting options:</p><p>1. Power BI service, a cloud-based hosting</p><p>2. Power BI report server on-premises hosting.</p><h3>Power BI Service reports and analytics</h3><p>Power BI service, offered by Microsoft and integrated with Azure and Office 365, is a cloud-based platform for hosting reports. There are several reasons why you might publish your report to Power BI service.</p><p>Some of the reasons include the following:</p><p>· You need to create business dashboards.</p><p>· You want to share your reports and dashboards with various people within and outside your organization.</p><p>· You want to manage your assets and create audience-specific workspaces and apps.</p><p>However, Power BI service is more than just a platform for hosting and sharing reports; it also offers various analytical tools and features. Which are:</p><p>· Dataflows</p><p>· Shared dataset</p><p>· Datamart</p><p>· Data lineage</p><p>· Sensitivity labels</p><p>· Deployment pipelines</p><p>· Workspaces</p><p>· Apps</p><h3>What is published to Power BI service?</h3><p>When you publish a Power BI file from the desktop to the Power BI service, you publish the following components:</p><p>· The data tables and columns</p><p>· The data model and schema design</p><p>· Any reports and visualizations you have created in Report view.</p><p>· All DAX measures you have created in the data model.</p><p>You’ll also publish other components like:</p><p>· The reports and any semantic model (datasets) you have in the Power BI desktop will be published to Power BI service with the same name.</p><p>· If your Power BI desktop file has sensitivity labels, the reports published to Power BI service will inherit the labels.</p><p>· If your Power BI report has a Direct Query connection with an on-premises SQL Server database, you must install and configure a data gateway to access the reports from Power BI service.</p><p>When you publish a visualization to the Power BI service with a specific theme, it will retain that theme. Power BI also lets you keep this original theme or switch to the dashboard’s theme when pinning a visual element as a tile to the dashboard.</p><h3>Replacing the existing file published from Power BI desktop</h3><p>If you edit a report in Power BI Desktop after publishing it to Power BI service, you must publish it again to update both the report and its datasets in the service.</p><p>However, take note of the following when replacing an existing file:</p><p>· You cannot publish two models with the same name.</p><p>· If you rename or delete a column or DAX measure in your Power BI desktop file, the visualization will be broken based on these changes.</p><p>· When you make changes to a Power BI file and republish it, a message indicates the number of reports, dashboards, and workspaces impacted by the change and asks you to confirm that you want to replace the current model with a modified one.</p><h3>Conclusion</h3><p>Power BI service is a cloud platform for publishing, sharing, and managing Power BI content. It allows you to upload datasets, data models, DAX calculations, and report visualizations from desktop files. Besides publishing and sharing, Power BI service also supports creating dataflows, DataMart, deployment pipelines, and other development assets.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be0330077aab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Configure table and column properties in Power Bi]]></title>
            <link>https://medium.com/@cherifal2011/configure-table-and-column-properties-in-power-bi-a0bc0eb53e36?source=rss-6519a3662616------2</link>
            <guid isPermaLink="false">https://medium.com/p/a0bc0eb53e36</guid>
            <dc:creator><![CDATA[Hamidou Cherif]]></dc:creator>
            <pubDate>Mon, 03 Jun 2024 16:33:47 GMT</pubDate>
            <atom:updated>2024-06-03T16:33:47.601Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*pbD8YgMAB9h6-mThAHXqGQ.jpeg" /></figure><h3>Introduction</h3><p>In the previous lesson, you learned how to configure the table and column properties of various tables of a data model. This activity is designed to empower you with hands-on experience in configuring and formatting both table and column properties in Microsoft Power BI Desktop. Specifically, in this activity, you will cover how to:</p><p>· Configure and format the table properties of your data model so that it is intuitive for the collaborators</p><p>· Format column properties such as data type and category so that the analysis provides accurate insights into the data</p><h3>Scenario</h3><p>Adventure Works management needs an accurate analysis of their sales data in a visually appealing dashboard. The first step in every analysis is preparing the data, where you need to perform formatting and configuration of the table and column properties within your data model. This will help you to visualize data accurately with properly formatted fields to avoid any confusion.</p><h3>Instructions</h3><h3>Step 1: Download and open the Adventure Works file Power BI project.</h3><p>Download the Adventure Works Power BI project file and save it to your computer. The data model contains four data tables: <strong>Sales</strong>, <strong>Products</strong>, <strong>Salesperson</strong>, and <strong>Region</strong>. The dimension tables are related to the fact table via one-to-many relationships.</p><h3>Step 2: Navigate to Model view and configure the table properties</h3><p>Model view in Power BI provides many options to update and configure the table and column properties.</p><ol><li>Once you launch Power BI and open the Adventure Works project, navigate to <strong>Model view</strong> to inspect the data model tables. The model contains four tables: <strong>Sales</strong>, <strong>Products</strong>, <strong>Salesperson, </strong>and <strong>Region</strong>. <strong>Sales </strong>is the fact table, while others are dimension tables.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*QcKjZW8fMbi1cvF_xRTSiQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*pzq-srZIX7rUWIhjb3gPRA.png" /></figure><ol><li>Select the <strong>Sales</strong> table and expand the <strong>Properties</strong> pane of the <strong>Model view</strong>. The <strong>Properties </strong>pane has two sections for formatting the table properties: <strong>General</strong> and <strong>Advanced</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*gYNKnMkjtqcId4O3HDk6aA.png" /></figure><p>1. In the <strong>General</strong> section, you can format the following:</p><p>o <strong>Name </strong>and <strong>Synonyms</strong>: For this activity, you can keep the name and synonyms of the table default.</p><p>o <strong>Description</strong>: The table description provides additional information or context about the table. For example, you can write, <strong>The sales table contains sales transactions from 2017 to 2020 for Adventure Works global operations</strong>. This information will provide appropriate context for the report and dataset collaborators without the need for them to dig deep into the data structure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*KSb-S6Q5wHus9jUjWH4Ymw.png" /></figure><p><strong>Row label</strong>: A row label allows you to define which column or field best identifies a single row in a table. This field is especially useful in dimension tables. For example, in the <strong>Product</strong> table, you can define the <strong>Product Color</strong> field as the row label. This enables the Power BI<strong> Q&amp;A </strong>functionality to create more helpful visuals when your report users ask specific questions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*UKiCgzCsVuWk1UuP_vkypQ.png" /></figure><p>o <strong>Key column: </strong>This column provides the unique values of the data table. In the <strong>Sales</strong> table, the key column is <strong>SalesOrderNumber</strong>. Select this from the drop-down field options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*PNGTPLuvLuHKqYJ-LdUrwg.png" /><figcaption>o Whether the table is hidden or not (<strong>Is hidden</strong>): You can hide the table from the <strong>Report view</strong> of Power BI Desktop by sliding the <strong>Is hidden</strong> toggle on. This feature is useful in aggregated tables while using DirectQuery connectivity. You do not need to configure this feature for this activity.<strong> Note: </strong>You can also rename the table and add a description in the Query Editor of Power BI.</figcaption></figure><ol><li>In the <strong>Advanced</strong> section of the <strong>Properties</strong> pane, you need to set the storage mode of the table. Currently, there is only one storage mode available — <strong>Import</strong>. <strong>Note: </strong>Power BI supports two more storage modes: <strong>DirectQuery</strong> and <strong>Dual Storage</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*6cJz0WE4JxknSmOJ2OFI6w.png" /></figure><h3>Step 3: Configure the column properties.</h3><ol><li>Select the <strong>Total Sales</strong> column from the <strong>Sales</strong> table. Under the <strong>General </strong>section, you need to format the following properties:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*Xm5n9QG2VygJQ9SjUJze-g.png" /></figure><p>o <strong>Name</strong> and <strong>Synonyms</strong>: You can leave these sections as default for this activity. However, keep in mind that you can change them if needed by your organization to meet specific business requirements.</p><p>o <strong>Description</strong>: In the description section, you can write additional details of the measurement presented in the column. For example, in the current example, type in <strong>Sales amounts in USD</strong>. This information specifies the currency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*g9kEQpp5m_bBgemV4SOv_g.png" /></figure><p>o <strong>Note: </strong>In any activity related to configuring properties, you do not necessarily need to configure all properties. This will depend on your dataset and what is required for your analysis. This activity mentions the various properties that you can configure, but not all will require configuration in the current context.</p><p>o <strong>Display folder: </strong>This is the utility feature where you can organize your measures and columns into folders.</p><p>o <strong>Is hidden: </strong>The last property is whether you want to hide the column from the <strong>Report view</strong>. This is useful if you want to hide some sensitive information from report viewers.</p><p>1. In the <strong>Formatting</strong> section, you need to format the following column properties:</p><p>o <strong>Data type: </strong>You need to select an appropriate data type depending on the field. For example, the <strong>Total Sales</strong> column contains sales amounts that should be in decimal number format. If not selected, choose <strong>Decimal number</strong> from the drop-down options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*pwEe-m8XX8dja0aMyJSkBA.png" /></figure><p><strong>Format: </strong>By default, <strong>General</strong> is selected. You need to select <strong>Currency </strong>from the drop-down. This formatting will display a $ sign before the sales amounts and is easy to comprehend for the report users. A new field appears where you need to specify the currency format. Select <strong>$ English (United States)</strong>. This feature allows you to display sales amounts in different currencies for overseas operations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*xBliWp4y9aSEKt5xWrLSMw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*9Nh3vuWZRH0EcC0_NnmOLg.png" /><figcaption>o<strong> Percentage format: By turning this toggle feature to the on position, Power BI displays the values as percentages. You do not need to configure this feature for the current activity.</strong></figcaption></figure><p>o <strong>Thousands separator</strong>: Turn this feature on in order for Power BI to display a thousand operator in the sales amount.</p><p>o <strong>Decimal places</strong>: <strong>Auto</strong> is selected by default. Enter <strong>2 </strong>to specify the decimal places for your fields or measures.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*aQci5EktIGXd-bUUtTI36A.png" /></figure><p>1. Finally, in the <strong>Advanced</strong> section, you need to configure the following column properties:</p><p>o <strong>Sort by column: </strong>This feature allows you to sort a field based on another column, depending on your visualization requirements. For example, you can sort the month name column either alphabetically or by month number. In this case, you can leave the default selection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*MUxTmrmbgMx-_qi58C_NBQ.png" /></figure><p>o <strong>Data category: </strong>This formatting is important while working with location-based data. For example, select the <strong>Country </strong>column from the <strong>Region</strong> table and then select <strong>Country/Region</strong> as the data category. Power BI detects this field as a country to accurately display the geographical boundaries on the map visual. A globe map icon appears before the field name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*YybyOmW0yhGDWCfmDAZy7w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*A8mx06e8-B0L-H9mK1tO8Q.png" /></figure><p>o <strong>Summarize by: </strong>This feature tells Power BI what arithmetic operation should be applied during aggregation and visualization<strong>. Sum </strong>is selected by default. You can keep this as is for the activity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*Abf51pdfDbb21eeq5RGMuw.png" /></figure><p>o <strong>Is nullable toggle: </strong>Turn this on only if your column or field contains null values. You do not need to turn this on for the current activity.</p><ol><li>Alternatively, you can also format the column properties from the <strong>Column tools</strong> tab in Power BI. You can access this tab from the <strong>Data view</strong> of Power BI Desktop.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*T1SaDd-A5ORhSedF-QcBkg.png" /></figure><h3>Conclusion</h3><p>Formatting the tables of a data model and configuring their column properties are essential components of data analysis and visualization in Power BI.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0bc0eb53e36" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Find top performing products in Power Bi.]]></title>
            <link>https://medium.com/@cherifal2011/find-top-performing-products-in-power-bi-a33fac6960ed?source=rss-6519a3662616------2</link>
            <guid isPermaLink="false">https://medium.com/p/a33fac6960ed</guid>
            <dc:creator><![CDATA[Hamidou Cherif]]></dc:creator>
            <pubDate>Mon, 03 Jun 2024 16:03:53 GMT</pubDate>
            <atom:updated>2024-06-03T16:03:53.251Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*pbD8YgMAB9h6-mThAHXqGQ.jpeg" /></figure><h3>Introduction</h3><p>You’ve learned how to transform and load data using Power BI’s Power Query. Now, you must apply your knowledge of data transformation to find top-performing products. In this activity, you’ll review the steps to manipulate and analyze data, focusing on using the <strong>Group By</strong> feature in Power Query. The goal is to adeptly identify top-selling products, leveraging the data transformation and loading techniques you’ve learned.</p><h3>Adventure Works case study</h3><p>Adventure Works must identify its top-selling products per country-region based on total sales amounts from its <strong>Sales</strong> dataset. The dataset includes varied products sold across different channels and regions. Your task is to help Adventure Works as follows:</p><p>· Apply <strong>Group By</strong> to the two columns, using <strong>Sales Amount</strong> as the aggregation,</p><p>· And to identify the top performing products per Category and Country-Region.</p><p>The objective is to provide clear insights into their highest revenue-generating products per Country, enabling strategic decision-making.</p><h3>Instructions</h3><h3>Step 1: Navigation to the task at hand.</h3><p>1. Download and launch the <em>FindTopPerformingProducts</em> Power BI file.</p><p><strong>Note:</strong> Ensure that the data is loaded correctly by downloading the <em>Adventure Works FactSales.xlsx</em> file and updating the data source path from the ribbon <strong>Home &gt; Data Source Settings</strong>.</p><ol><li>Select <strong>Transform data</strong> to navigate to the Power Query Editor.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*Vpcey6QpG5b9DTJkQv75AA.png" /></figure><ol><li>Select the <strong>Sales</strong> table on the left sidebar and use the scroll bar on the bottom to locate the last two columns: <strong>Category</strong> and <strong>Country-Region</strong>. Identify that the <strong>Category</strong> and <strong>Country-Region</strong> columns do not contain unique values, so they can be aggregated to provide product-specific insights.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*7tsic622G7fqrR5QFmOtjA.png" /></figure><h3>Step 2: Group By transformation</h3><p>1. You now need to apply the <strong>Group By</strong> transformation. This option can be found in three places:</p><p>o On the <strong>Home</strong> tab in the <strong>Transform </strong>group. [Home, Transform Group, Group By]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*Jeq8GJSiG2Nr3JpbJH70vA.png" /></figure><p>o On the <strong>Transform</strong> tab in the <strong>Table </strong>group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*ApeaS0thtm0LOD686cYh6Q.png" /></figure><p>o On the shortcut menu, when you right-click to select columns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*lN0LkZIwu-nx-FjzVegT6g.png" /></figure><ol><li>Select <strong>Group By</strong> from any of the options above to access the <strong>Group By</strong> window.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*WYQ0_V-C3cqzv-A_2s6NLg.png" /></figure><ol><li>Select the <strong>Advanced</strong> radio button to add multiple columns to the aggregation. Ensure both <strong>Country-Region</strong> and <strong>Category</strong> are added to the grouping.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*poAYBHoEzojpRw4xj4qG4Q.png" /></figure><ol><li>For the calculation, you must sum the total of the <strong>Order amount</strong>. Provide <strong>Total amount</strong> as the new column name. Choose <strong>Sum</strong> as the operation, and <strong>Sales Amount</strong> as the column.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*01jc7Wy_DVv_d2-OakVxBw.png" /></figure><ol><li>Select <strong>Add Aggregation</strong> to add another calculation on the new table.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*EuODx9defVpyIEEWBuzSgQ.png" /></figure><ol><li>Each row of the <strong>Sales</strong> table represents an order. To calculate the total count of orders for every product per region, name the second aggregation <strong>Order Count</strong>, and assign the default <strong>Count Rows</strong> operation.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*HddDIV1zbhLwd3qGUkBm5A.png" /></figure><p><strong>Tip:</strong> No Column is required for the <strong>Count Rows </strong>operation, as it counts all the table rows before performing an aggregation.</p><p>1. To calculate the top-performing product, you require another aggregation, performing the <strong>All Rows</strong> operation on the table. Add another aggregation, also named <strong>All Rows</strong>.</p><p>2. Select <strong>OK</strong> to complete the <strong>Group By</strong> transformation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*JPlRAFcPW6kaWgqXOFKEMQ.png" /></figure><h3>Step 3: Extract the top-performer product information.</h3><ol><li>When the <strong>Group By </strong>transformation is ready, your table will now contain the two grouped columns, along with the three new aggregation columns.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*AzBHIYc08kTzWPsJRxu97Q.png" /></figure><ol><li>The <strong>All Rows</strong> column, specifically, contains all table rows that contribute to the aggregations. You can select any <strong>Table</strong> value on any row to preview the original <strong>Sales Table</strong> rows that contribute to this aggregation.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*hOuJIxTI1D9yo4wEy1NbSA.png" /></figure><ol><li>To identify the best-performing product for each <strong>Category per Country-Region</strong>, create a new column using the <strong>Add Column</strong> tab on the ribbon and select <strong>Custom Column</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*nQ3doNcqFnNzxIkvWUk4Kg.png" /></figure><ol><li>On the Custom Column dialog, name the new column <strong>Top performer product</strong> and input the following code: <strong>Table.Max( Table.Group([All Rows], “Product”, {“Total Sales”, each List.Sum([Sales Amount]) } ), “Total Sales”)</strong>. Select <strong>OK</strong> to create the new column.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*CRZAT9Qnu74Lec5WqtvVxg.png" /></figure><ol><li>The result of the formula creates a new column with <strong>Record</strong> values. These record values are essentially a table with just one row. These records contain the row with the maximum value for each <strong>Table </strong>value in the <strong>Products </strong>column.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*EbD4NOEEHbFWqtwLPgZ5mw.png" /></figure><ol><li>With the new <strong>Top performer product</strong> column that contains <strong>Record </strong>values, you can select the expand icon (represented by two outward-facing arrows) to the right of the column title. Then, select the <strong>Product </strong>field, followed by <strong>OK</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*_OQD0YW4zsKMwxjZRFp0DQ.png" /></figure><ol><li>The <strong>Top performing products per category</strong> and <strong>Country</strong> are now found in the new column.</li></ol><h3>Conclusion</h3><p>Congratulations! You have successfully identified the top-selling products in Adventure Works’ sales dataset using Power BI’s Power Query. This allows you to transform complex data into actionable business insights. By mastering data aggregation and analysis techniques, you can drive strategic business decisions through informed data interpretation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a33fac6960ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sorting columns in Power BI.]]></title>
            <link>https://medium.com/@cherifal2011/sorting-columns-in-power-bi-702300882eea?source=rss-6519a3662616------2</link>
            <guid isPermaLink="false">https://medium.com/p/702300882eea</guid>
            <dc:creator><![CDATA[Hamidou Cherif]]></dc:creator>
            <pubDate>Mon, 03 Jun 2024 15:46:19 GMT</pubDate>
            <atom:updated>2024-06-03T15:46:19.012Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*pbD8YgMAB9h6-mThAHXqGQ.jpeg" /></figure><h3>Introduction</h3><p>Sorting columns is an important step in data transformation within Microsoft Power Query. It helps you to organize and analyze data more effectively to reveal trends and patterns. Sorting also plays a key role in data cleaning, comparative analysis, and data navigation. In this exercise, you are going to sort columns in Power Query.</p><h3>Scenario</h3><p>Working as a Data Analyst at Adventure Works is not an easy job. You have to deal with lots of data every day. While preparing a report from quarterly sales data, your team lead asked you to transform the data in such a way that anyone can have a look at the data in Power Query and quickly understand how various regions and customer locations are doing in sales. This can be done by sorting the data columns properly. For example, you can sort the <strong>Region</strong> and <strong>Customer Location</strong> columns in ascending or descending order and then the <strong>Order Total</strong> column in descending order.</p><p>Here is the initial state of data before applying any sorting:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*n66hKR6Xs5zegs9eVd9B7A.png" /></figure><p>Here is the result after applying the sorting:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*N9JF4hb-FBevvVXa4WLE1Q.png" /></figure><p>Your task is to follow the instructions and sort the columns properly in Power Query.</p><h3>Instructions</h3><h3>Step 1: Open the Power BI file in Power BI Desktop.</h3><p><strong>Note: </strong>It’s normal for no visuals to display at this stage; Ensure that the data is loaded correctly by downloading the <em>AdventureWorksSales.xlsx</em> file and updating the data source path from the ribbon <strong>Home &gt; Data Source Settings</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*afvsnVAIU5upCLZYe29MNg.png" /></figure><h3>Step 2: Open Power Query</h3><p>· Select <strong>Transform data</strong> from the <strong>Home </strong>ribbon and select <strong>Transform data</strong>. This action will lead you into the Power Query, where your data is prepared for transformation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*yeT6VMstUx8mVBoJr58w2A.png" /></figure><h3>Step 3: Close the Query Settings pane.</h3><p>· To increase the visible data area, close the <strong>Query Settings</strong> pane.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*rjZpdY74j4VSfgcTmnN0Vg.png" /></figure><h3>Step 4: Position key columns</h3><p>· Scroll horizontally to view the following columns: <strong>Product Region</strong>, <strong>Customer Location</strong>, and <strong>Order Total</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*K1a3-_aoih3NGtWGUuaM1w.png" /></figure><h3>Step 5: Sort the Product Region column.</h3><p>1. Select the dropdown icon beside the <strong>Product Region</strong> column header. This opens a new popup.</p><p>2. Select <strong>Sort descending</strong> from this dropdown menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*8rxIImVYnWGFVYMVOWy31w.png" /></figure><h3>Step 6: Sort the Customer Location column.</h3><p>· Select the dropdown icon beside the <strong>Customer Location </strong>column header and select <strong>Sort ascending </strong>from this dropdown menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*dhpqE3m5JFUQ1g6P4UFz0A.png" /></figure><h3>Step 7: Sort the Order Total column.</h3><p>· Select the dropdown icon beside the <strong>Order Total </strong>column header and select <strong>Sort descending </strong>from this dropdown menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*3Lw4poqQjS_dv7dH5COQ9g.png" /></figure><h3>Step 8: Check everything.</h3><p>· Ensure all columns are sorted correctly: <strong>Product Region</strong> in descending, <strong>Customer Location</strong> in ascending, and <strong>Order Total</strong> in descending order.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*bQcy-HQ3PN50OCfbLc3CCQ.png" /></figure><h3>Step 9: Apply the transformation.</h3><p>· If everything appears correct, select <strong>Close and Apply</strong> on the <strong>Home</strong> ribbon to apply the transformations to your data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*nNK5QUXYRUKG-ZuAWPVnsw.png" /></figure><h3>Conclusion</h3><p>In this exercise, you have adeptly maneuvered through Power BI Desktop, effectively organizing and sorting pivotal data columns. Arranging the <strong>Product Region</strong>, <strong>Customer Location</strong>, and <strong>Order Total</strong> columns is crucial when applying these skills in practical scenarios. By implementing column sorting, you’ve enhanced your knowledge of data organization and cleansing, which is essential to deriving useful insights from your data.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=702300882eea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Shape and transform tables in Power BI.]]></title>
            <link>https://medium.com/@cherifal2011/shape-and-transform-tables-in-power-bi-1cccc1deac4c?source=rss-6519a3662616------2</link>
            <guid isPermaLink="false">https://medium.com/p/1cccc1deac4c</guid>
            <category><![CDATA[power-bi-training]]></category>
            <dc:creator><![CDATA[Hamidou Cherif]]></dc:creator>
            <pubDate>Mon, 03 Jun 2024 15:32:18 GMT</pubDate>
            <atom:updated>2024-06-03T15:32:18.981Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*pbD8YgMAB9h6-mThAHXqGQ.jpeg" /></figure><h3>Introduction</h3><p>So far, you’ve reviewed how to create and transform columns in Microsoft Power BI. In this activity, you’ll now apply your knowledge of Power Query to transform and shape data in a dataset.</p><h3>Scenario</h3><p>At Adventure Works, the CEO wants you to prepare a report on the top products sold in each sales region. Unfortunately, the system that the sales team is using to track product rankings has output the data in a format unsuitable to present to the CEO. Fortunately, you know how to transform the data using Power BI so that it is suitable for presentation.</p><h3>Instructions</h3><h3>Step 1: Connect to the data source.</h3><ol><li>Open Power BI and create a new project.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*pfe5CyB-JZQK8j5_8zwvBQ.png" /></figure><ol><li>On the <strong>Home</strong> tab of the ribbon, select <strong>Get Data</strong> and choose <strong>Excel workbook</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*wX1Kij_QEHcOZvvZc77FIw.png" /></figure><p>1. When the file browser opens, select the <em>TopProducts.xlsx file</em>.</p><p>2. In the <strong>Navigator</strong> window, select the <strong>Top Products</strong> sheet and select <strong>Transform Data</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*2f7-Km3nrLgSDvdhww2_Rw.png" /></figure><h3>Step 2: Reduce columns and rows.</h3><ol><li>When the Power Query Editor opens, select <strong>Use First Row as Headers</strong> in the <strong>Home</strong> tab of the ribbon menu.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*-myspVOskrLwVCOk06k3ig.png" /></figure><p>1. This will add two steps, <strong>Promote Headers </strong>and <strong>Changed Type1</strong>, to the <strong>Applied Steps</strong> list.</p><p>2. Note that the headers are now the correct headers, based on the first row of data; <strong>Region</strong>, <strong>Rank 1</strong>, <strong>Rank 2</strong>, and so on.</p><p>3. Next, select <strong>Remove Rows</strong> and then <strong>Remove Duplicates</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*SZece_p0WMieyPY84fY-Ww.png" /></figure><p>1. This will add a <strong>Removed Duplicates</strong> step to the <strong>Applied Steps</strong> list. The dataset will now consist of 3 rows.</p><p>2. Next, scroll to the last column, <strong>ID</strong>. Right-click the column name and select <strong>Remove</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*F_15Tu117SWIIjqbEQswKA.png" /></figure><p>1. This will add a <strong>Removed Columns</strong> step to the <strong>Applied Steps</strong> list and remove the column. The data is now ready to be unpivoted into a more appropriate ranking format.</p><h3>Step 3: Unpivot the data</h3><ol><li>Navigate to the first column in the data, <strong>Region</strong>, and select the column. Then select the <strong>Transform</strong> tab in the ribbon menu. Select the <strong>Unpivot Columns</strong> dropdown and select <strong>Unpivot Other Columns</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*Thu4hHmbCIVpKjJ7glKhmQ.png" /></figure><ol><li>The data is now unpivoted into three columns; <strong>Region</strong>, <strong>Attribute</strong>, and <strong>Value</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*g5QjAMI5JQp3GzE0hCFlug.png" /></figure><h3>Step 4: Format the data.</h3><ol><li>First, rename the <strong>Attribute</strong> and <strong>Value</strong> columns. To do this, double-click on the column name. Rename the <strong>Attribute</strong> column to <strong>Rank</strong> and the <strong>Value</strong> column to <strong>Product</strong>. This will add a <strong>Renamed Columns</strong> step to the <strong>Applied Steps</strong> list.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*YWrXu4913mjV7JjtSOOP-g.png" /></figure><ol><li>Next, you must remove the word <strong>Rank </strong>from each value in the <strong>Rank</strong> column so that you can change the column type. To do this, first select the <strong>Rank</strong> column. Then select the <strong>Extract</strong> dropdown in the <strong>Transform </strong>tab, and select <strong>Text After Delimiter</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*zwwHhJW-kRBg9KUjAxbzDQ.png" /></figure><ol><li>In the <strong>Text After Delimiter</strong> prompt, enter a single space (spacebar) as the delimiter and select <strong>OK</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*vTwrmGAoabt-2w_sejcK8A.png" /></figure><ol><li>The <strong>Rank </strong>column will now consist of numeric values. However, its data type is still <strong>Text</strong>. Select the <strong>Data Type</strong> button and change its data type to <strong>Whole Number</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*wnD6lrpURkRM2it7Vprihg.png" /></figure><h3>Step 5: Load the data.</h3><ol><li>The data is now ready to be loaded into Power BI. In the <strong>Home</strong> tab of the ribbon menu, select <strong>Close &amp; Apply.</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*HQaRI_h56GBMgRHefQxhZg.png" /></figure><p>1. Once the data is loaded, save the project.</p><h3>Conclusion</h3><p>Congratulations! You have successfully shaped and transformed the dataset. The data is now ready for visualization and presentation to the CEO of Adventure Works Good job!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1cccc1deac4c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>