<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Selective Colouring | Capstone Analytics</title>
	<atom:link href="https://capstoneanalytics.com.au/tag/selective-colouring/feed/" rel="self" type="application/rss+xml" />
	<link>https://capstoneanalytics.com.au</link>
	<description>Analytics Simplified</description>
	<lastBuildDate>Fri, 10 Jul 2020 01:14:23 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Strategic colouring in Power BI-Part 8: Transforming a stacked column chart to highlight individual series</title>
		<link>https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-8-transforming-a-stacked-column-chart-to-highlight-individual-series/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=strategic-colouring-in-power-bi-part-8-transforming-a-stacked-column-chart-to-highlight-individual-series</link>
					<comments>https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-8-transforming-a-stacked-column-chart-to-highlight-individual-series/#respond</comments>
		
		<dc:creator><![CDATA[Abhijith DSouza]]></dc:creator>
		<pubDate>Fri, 10 Jul 2020 01:12:57 +0000</pubDate>
				<category><![CDATA[Power BI]]></category>
		<category><![CDATA[DAX]]></category>
		<category><![CDATA[Selective Colouring]]></category>
		<category><![CDATA[Stacked column chart]]></category>
		<category><![CDATA[Strategic Colouring]]></category>
		<guid isPermaLink="false">https://capstoneanalytics.com.au/?p=2356</guid>

					<description><![CDATA[This is the eighth post in the Strategic colouring in Power BI series. Links to all the posts can be found here https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/ Stacked column charts are hard to visualise especially when you have more than four &#8220;stacks&#8221; and if one of them predominates its harder to visualise even with using the right colour gradients. [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>This is the eighth post in the Strategic colouring in Power BI series. Links to all the posts can be found here</p>
<p><a href="https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/">https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/</a></p>
<p>Stacked column charts are hard to visualise especially when you have more than four &#8220;stacks&#8221; and if one of them predominates its harder to visualise even with using the right colour gradients.</p>
<p>There needs to be a better way to visualise stacked column charts and a recent problem I have been working on provided me with an opportunity to do so. I wanted to visualise client debts by month broken down into five bands. The chart looked like this when all the formatting was applied</p>
<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-2358" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/07/debt-stacked-chart.png" alt="" width="597" height="370" srcset="https://capstoneanalytics.com.au/wp-content/uploads/2020/07/debt-stacked-chart.png 597w, https://capstoneanalytics.com.au/wp-content/uploads/2020/07/debt-stacked-chart-480x297.png 480w" sizes="(min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 597px, 100vw" /></p>
<p>As you can see its hard to visualise this chart as your eyes go back and forth between the chart and the legend to see what the bands are. You can click on the legend like below to isolate an individual band but its not the best user experience. So lets see if we can improve upon this.</p>
<p><img decoding="async" class="alignnone wp-image-2361" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/07/20200710_103629-2.gif" alt="" width="745" height="404" /></p>
<p>Our Debt table looks like this and it is connected to the Band table having Band as a column in a many to one relationship</p>
<p><img decoding="async" class="alignnone size-full wp-image-2364" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/07/debt-table.png" alt="" width="268" height="288" /></p>
<p>We first define a measure which will give the debt for the selected band.</p>
<p>Selected Debt =<br />
<span class="Keyword" style="color: #035aca;">IF</span><span class="Parenthesis" style="color: #808080;"> (</span> <span class="Keyword" style="color: #035aca;">ISFILTERED</span><span class="Parenthesis" style="color: #808080;"> (</span> Band[Band] <span class="Parenthesis" style="color: #808080;">)</span>, <span class="Keyword" style="color: #035aca;">SUM</span><span class="Parenthesis" style="color: #808080;"> (</span> Debt[Amount] <span class="Parenthesis" style="color: #808080;">)</span>, <span class="Number" style="color: #ee7f18;">0</span> <span class="Parenthesis" style="color: #808080;">)</span></p>
<p>We then define five measures for the five bands. An example is given below</p>
<p>Debt &lt;30Days =<br />
<span class="Keyword" style="color: #035aca;">VAR</span> <span class="Variable" style="color: #49b0af;">selband</span> =<br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">VALUES</span><span class="Parenthesis" style="color: #808080;"> (</span> Band[Band] <span class="Parenthesis" style="color: #808080;">)</span><br />
<span class="Keyword" style="color: #035aca;">RETURN</span><br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">IF</span><span class="Parenthesis" style="color: #808080;"> (</span><br />
<span class="indent8">        </span><span class="StringLiteral" style="color: #d93124;">&#8220;&lt;30 Days&#8221;</span> <span class="Keyword" style="color: #035aca;">IN</span> <span class="Variable" style="color: #49b0af;">selband</span><br />
<span class="indent8">        </span><span class="indent4">    </span>&amp;&amp; <span class="Keyword" style="color: #035aca;">ISFILTERED</span><span class="Parenthesis" style="color: #808080;"> (</span> Band[Band] <span class="Parenthesis" style="color: #808080;">)</span>,<br />
<span class="indent8">        </span><span class="Number" style="color: #ee7f18;">0</span>,<br />
<span class="indent8">        </span><span class="Keyword" style="color: #035aca;">CALCULATE</span><span class="Parenthesis" style="color: #808080;"> (</span> <span class="Keyword" style="color: #035aca;">SUM</span><span class="Parenthesis" style="color: #808080;"> (</span> Debt[Amount] <span class="Parenthesis" style="color: #808080;">)</span>, Band[Band] = <span class="StringLiteral" style="color: #d93124;">&#8220;&lt;30 Days&#8221;</span> <span class="Parenthesis" style="color: #808080;">)</span><br />
<span class="indent4">    </span><span class="Parenthesis" style="color: #808080;">)</span></p>
<p>What we are doing here is anytime the band &#8220;&lt;30 Days&#8221; is selected in the slicer and if the column band is filtered the debt amount is shown as zero else the debt amount is shown for that band. This is the opposite of what we normally do because we already have a measure [Selected Debt] which gives the debt amount for the selected band.</p>
<p>We define the other four measures replacing &#8220;&lt;30 Days&#8221; with the appropriate band.</p>
<p>We also define another measure to get the percentage debt in the selected bands</p>
<p>Selected Debt% =<br />
[Selected Debt] / <span class="Keyword" style="color: #035aca;">CALCULATE</span><span class="Parenthesis" style="color: #808080;"> (</span> <span class="Keyword" style="color: #035aca;">SUM</span><span class="Parenthesis" style="color: #808080;"> (</span> Debt[Amount] <span class="Parenthesis" style="color: #808080;">)</span>, <span class="Keyword" style="color: #035aca;">ALL</span><span class="Parenthesis" style="color: #808080;"> (</span> Band[Band] <span class="Parenthesis" style="color: #808080;">)</span> <span class="Parenthesis" style="color: #808080;">)</span></p>
<p>We are ready to visualise the data. In the stacked column chart visual drag Month into Axis, and the first six measures which we defined into Values. Make the colour of [Selected Debt] measure as something which stands out (say Orange) and others as grey. The set up should look like this</p>
<p>&nbsp;</p>
<p><img loading="lazy" decoding="async" class="alignnone  wp-image-2365" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/07/final-debt-chart.png" alt="" width="808" height="259" /></p>
<p>No band is highlighted as we have not yet selected a band from the slicer. Drag the Band column from the Band table into a slicer. Import the &#8220;Data story&#8221; custom visual and place it on the canvas and drag [Selected Debt%] into data values and under the Story section of the visual write this text &#8220;The selected band(s) account for # of all debts&#8221;</p>
<p>Now we are good to visualise our data</p>
<div style="width: 1080px;" class="wp-video"><video class="wp-video-shortcode" id="video-2356-1" width="1080" height="585" preload="metadata" controls="controls"><source type="video/mp4" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/07/20200710_110929.mp4?_=1" /><a href="https://capstoneanalytics.com.au/wp-content/uploads/2020/07/20200710_110929.mp4">https://capstoneanalytics.com.au/wp-content/uploads/2020/07/20200710_110929.mp4</a></video></div>
]]></content:encoded>
					
					<wfw:commentRss>https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-8-transforming-a-stacked-column-chart-to-highlight-individual-series/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		<enclosure url="https://capstoneanalytics.com.au/wp-content/uploads/2020/07/20200710_110929.mp4" length="684919" type="video/mp4" />

			</item>
		<item>
		<title>Strategic colouring in Power BI-Part 7: Dynamically plotting yearly percentage sales of top N products and measuring against a dynamic target</title>
		<link>https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-7-dynamically-plotting-yearly-percentage-sales-of-top-n-products-and-measuring-against-a-dynamic-target/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=strategic-colouring-in-power-bi-part-7-dynamically-plotting-yearly-percentage-sales-of-top-n-products-and-measuring-against-a-dynamic-target</link>
					<comments>https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-7-dynamically-plotting-yearly-percentage-sales-of-top-n-products-and-measuring-against-a-dynamic-target/#respond</comments>
		
		<dc:creator><![CDATA[Abhijith DSouza]]></dc:creator>
		<pubDate>Sat, 06 Jun 2020 04:03:10 +0000</pubDate>
				<category><![CDATA[Power BI]]></category>
		<category><![CDATA[DAX]]></category>
		<category><![CDATA[Selective Colouring]]></category>
		<category><![CDATA[Strategic Colouring]]></category>
		<category><![CDATA[Top 10]]></category>
		<guid isPermaLink="false">https://capstoneanalytics.com.au/?p=2254</guid>

					<description><![CDATA[This is the seventh post in the Strategic colouring in Power BI series. Links to all the posts can be found here https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/ In the sixth post, we discussed how to isolate and visualise YTD data In this post we will discuss how to dynamically calculate the yearly percentage sales of top N products and [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>This is the seventh post in the Strategic colouring in Power BI series. Links to all the posts can be found here</p>
<p><a href="https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/">https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/</a></p>
<p>In the sixth <a href="https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-6-visually-showcasing-the-years-in-which-a-selected-product-is-the-top-product/">post</a>, we discussed how to isolate and visualise YTD data</p>
<p>In this post we will discuss how to dynamically calculate the yearly percentage sales of top N products and measure it against a target % value. The technique used is different than the one used in the previous post. In the previous post we plotted sales of top 10 products by filtering the visuals to give the top 10 sales. This gave us the sales of the global top 10 products for each year. However what we want is the sales of top 10 products for each year and plot it accordingly.</p>
<p>We will use the same data model as the previous post. Since we will be dynamically plotting the sales, we need to calculate two parameters, one for top N and the other for target %. Our topN parameter  and target % parameter will be defined like this. Make sure the &#8216;Add slicer to this page&#8217; option is selected.</p>
<p><img loading="lazy" decoding="async" class="wp-image-2256 alignleft" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/06/TopN-parameter.png" alt="" width="368" height="353" /> <img loading="lazy" decoding="async" class="alignnone wp-image-2255" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/06/Target-.png" alt="" width="389" height="365" /></p>
<p>Next we will calculate the Top N sales measure incorporating the TopN value measure defined in previous step</p>
<p>TopN Sales =<br />
<span class="Keyword" style="color: #035aca;">VAR</span> <span class="Variable" style="color: #49b0af;">top10sales</span> =<br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">ADDCOLUMNS</span><span class="Parenthesis" style="color: #808080;"> (</span><br />
<span class="indent8">        </span><span class="Keyword" style="color: #035aca;">GENERATE</span><span class="Parenthesis" style="color: #808080;"> (</span><br />
<span class="indent8">        </span><span class="indent4">    </span><span class="Keyword" style="color: #035aca;">VALUES</span><span class="Parenthesis" style="color: #808080;"> (</span> &#8216;Date'[Year] <span class="Parenthesis" style="color: #808080;">)</span>,<br />
<span class="indent8">        </span><span class="indent4">    </span><span class="Keyword" style="color: #035aca;">TOPN</span><span class="Parenthesis" style="color: #808080;"> (</span> [TopN Value], <span class="Keyword" style="color: #035aca;">VALUES</span><span class="Parenthesis" style="color: #808080;"> (</span> Products[ProductID.Product] <span class="Parenthesis" style="color: #808080;">)</span>, [Total Sales] <span class="Parenthesis" style="color: #808080;">)</span><br />
<span class="indent8">        </span><span class="Parenthesis" style="color: #808080;">)</span>,<br />
<span class="indent8">        </span><span class="StringLiteral" style="color: #d93124;">&#8220;TotalSalesTop10&#8221;</span>, [Total Sales]<br />
<span class="indent4">    </span><span class="Parenthesis" style="color: #808080;">)</span><br />
<span class="Keyword" style="color: #035aca;">RETURN</span><br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">SUMX</span><span class="Parenthesis" style="color: #808080;"> (</span> <span class="Variable" style="color: #49b0af;">top10sales</span>, [TotalSalesTop10] <span class="Parenthesis" style="color: #808080;">)</span></p>
<p>The topN sales % is calculated as</p>
<p>Top 10 Sales % =<br />
<span class="Keyword" style="color: #035aca;">DIVIDE</span><span class="Parenthesis" style="color: #808080;"> (</span> [TopN Sales], [Total Sales] <span class="Parenthesis" style="color: #808080;">)</span></p>
<p>In order to achieve strategic colouring we need to define three measures and compare the TopN sales % against the target measure</p>
<p>TopN Sales % Above Target =<br />
<span class="Keyword" style="color: #035aca;">IF</span><span class="Parenthesis" style="color: #808080;"> (</span> [TopN Sales %] &gt;= [Target % Value], [TopN Sales %], <span class="Number" style="color: #ee7f18;">0</span> <span class="Parenthesis" style="color: #808080;">)</span></p>
<p>TopN Sales % Below Target =<br />
<span class="Keyword" style="color: #035aca;">IF</span><span class="Parenthesis" style="color: #808080;"> (</span> [TopN Sales %] &lt; [Target % Value], [TopN Sales %], <span class="Number" style="color: #ee7f18;">0</span> <span class="Parenthesis" style="color: #808080;">)</span></p>
<p>Total Sales Remaining % =<br />
<span class="Number" style="color: #ee7f18;">1</span> &#8211; [TopN Sales % Above Target] &#8211; [TopN Sales % Below Target]</p>
<p>Now we are ready to plot. Create a line and stacked column chart and drag Year into Axis and drag the above three measures into Column values and drag Target % value into Line values. Under Data colours section of the chart give the following colours to the measures</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-2257" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/06/TopN-sales-data-colours.png" alt="" width="207" height="295" /></p>
<p>You can interact with the chart by changing the TopN and Target % sliders and see the effect on the charts</p>
<p>&nbsp;</p>
<div style="width: 1080px;" class="wp-video"><video class="wp-video-shortcode" id="video-2254-2" width="1080" height="552" preload="metadata" controls="controls"><source type="video/mp4" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/06/TopN-sales-against-a-target.mp4?_=2" /><a href="https://capstoneanalytics.com.au/wp-content/uploads/2020/06/TopN-sales-against-a-target.mp4">https://capstoneanalytics.com.au/wp-content/uploads/2020/06/TopN-sales-against-a-target.mp4</a></video></div>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-7-dynamically-plotting-yearly-percentage-sales-of-top-n-products-and-measuring-against-a-dynamic-target/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		<enclosure url="https://capstoneanalytics.com.au/wp-content/uploads/2020/06/TopN-sales-against-a-target.mp4" length="396072" type="video/mp4" />

			</item>
		<item>
		<title>Strategic colouring in Power BI – Part 6: Visually showcasing the years in which a selected product is the top product</title>
		<link>https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-6-visually-showcasing-the-years-in-which-a-selected-product-is-the-top-product/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=strategic-colouring-in-power-bi-part-6-visually-showcasing-the-years-in-which-a-selected-product-is-the-top-product</link>
					<comments>https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-6-visually-showcasing-the-years-in-which-a-selected-product-is-the-top-product/#respond</comments>
		
		<dc:creator><![CDATA[Abhijith DSouza]]></dc:creator>
		<pubDate>Mon, 13 Apr 2020 22:34:00 +0000</pubDate>
				<category><![CDATA[Power BI]]></category>
		<category><![CDATA[DAX]]></category>
		<category><![CDATA[Selective Colouring]]></category>
		<category><![CDATA[Strategic Colouring]]></category>
		<guid isPermaLink="false">https://capstoneanalytics.com.au/?p=2212</guid>

					<description><![CDATA[This is the sixth post in the Strategic colouring in Power BI series. Links to all the posts can be found here https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/ In the fifth post, we showcased how to visually determine the difference in sales from a base year for different segments In this instalment we will discuss how to visually display the [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>This is the sixth post in the Strategic colouring in Power BI series. Links to all the posts can be found here</p>
<p><a href="https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/">https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/</a></p>
<p>In the fifth <a href="https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-5-difference-in-sales-from-a-base-year-for-different-segments/">post</a>, we showcased how to visually determine the difference in sales from a base year for different segments</p>
<p>In this instalment we will discuss how to visually display the top 10 products on a yearly basis</p>
<p>Creating a Top 10 chart in Power BI is very easy. You select the Products and apply a top 10 filter on it on the metric of your choice. But what if you wanted to create a top 10 chart for the products on a yearly basis.</p>
<p>This is easy as well. We create a bar chart and drag Year into Axis and [Total Sales] into Value and apply a top 10 filter on the visual on the ProductID.Product column. We also want to see what are the top products so we drag ProductID.Product column into Legend. The setup looks like this.</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2213" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/top-10-products.png" alt="" width="1281" height="367" srcset="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/top-10-products.png 1281w, https://capstoneanalytics.com.au/wp-content/uploads/2020/04/top-10-products-980x281.png 980w, https://capstoneanalytics.com.au/wp-content/uploads/2020/04/top-10-products-480x138.png 480w" sizes="auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1281px, 100vw" /></p>
<p>Now the Total Sales for all the years is $5.13bn so the above chart looks a bit suspicious. The maximum sales of the top 10 products for a year is in 2007 and its only $80mn. Lets investigate this further. Lets click on the ellipses on the top right hand corner and select Show as a table to get this view</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2214" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/top-10-products-2.png" alt="" width="1350" height="816" srcset="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/top-10-products-2.png 1350w, https://capstoneanalytics.com.au/wp-content/uploads/2020/04/top-10-products-2-1280x774.png 1280w, https://capstoneanalytics.com.au/wp-content/uploads/2020/04/top-10-products-2-980x592.png 980w, https://capstoneanalytics.com.au/wp-content/uploads/2020/04/top-10-products-2-480x290.png 480w" sizes="auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) and (max-width: 1280px) 1280px, (min-width: 1281px) 1350px, 100vw" /></p>
<p>We see some gaps in the data. In some years there are no sales against some products. So what is happening here ? The top 10 filter we applied on this chart is the top 10 products for all sales for all the years. Hence while there might be products like 449.Maximus UM-54 which is in the top 10 products for all years it may not be in the top 10 for some years. We take note of this and move on as for this exercise we do not need a chart which shows the yearly top 10 values. We will cover that in future posts.</p>
<p>Remove the ProductID.Product column from the legend in the chart. We want to highlight any product in the chart by selecting a product from a slicer. We place the ProductID.Product column into a slicer and apply a top 10 filter on it so that only the top 10 products are shown. But when we select any product the chart is filtered and we do not want that. In order to highlight the products we do the following</p>
<div style="width: 1080px;" class="wp-video"><video class="wp-video-shortcode" id="video-2212-3" width="1080" height="398" preload="metadata" controls="controls"><source type="video/mp4" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/top-10-products.mp4?_=3" /><a href="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/top-10-products.mp4">https://capstoneanalytics.com.au/wp-content/uploads/2020/04/top-10-products.mp4</a></video></div>
<p>We have managed to highlight the products but we do not stop here. We want to know in which years is the selected product the top selling product. And we will use strategic colouring to achieve it.</p>
<p>For this we create a copy of the Products table and call it Products 2 and define four measures as follows</p>
<p>TopProduct =<br />
<span class="Keyword" style="color: #035aca;">VAR</span> <span class="Variable" style="color: #49b0af;">topprod</span> =<br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">TOPN</span><span class="Parenthesis" style="color: #808080;"> (</span> <span class="Number" style="color: #ee7f18;">1</span>, <span class="Keyword" style="color: #035aca;">VALUES</span><span class="Parenthesis" style="color: #808080;"> (</span> Products[Product] <span class="Parenthesis" style="color: #808080;">)</span>, [Total Sales] <span class="Parenthesis" style="color: #808080;">)</span><br />
<span class="Keyword" style="color: #035aca;">RETURN</span><br />
<span class="indent4">    </span><span class="Variable" style="color: #49b0af;">topprod</span></p>
<p>Total Sales Top Product =<br />
<span class="Keyword" style="color: #035aca;">VAR</span> <span class="Variable" style="color: #49b0af;">table1</span> =<br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">SUMMARIZE</span><span class="Parenthesis" style="color: #808080;"> (</span><br />
<span class="indent8">        </span>Sales,<br />
<span class="indent8">        </span>&#8216;Date'[Year],<br />
<span class="indent8">        </span>Products[ProductID],<br />
<span class="indent8">        </span><span class="StringLiteral" style="color: #d93124;">&#8220;SalesProducts&#8221;</span>, [Total Sales]<br />
<span class="indent4">    </span><span class="Parenthesis" style="color: #808080;">)</span><br />
<span class="Keyword" style="color: #035aca;">RETURN</span><br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">IF</span><span class="Parenthesis" style="color: #808080;"> (</span><br />
<span class="indent8">        </span>[TopProduct] = <span class="Keyword" style="color: #035aca;">SELECTEDVALUE</span><span class="Parenthesis" style="color: #808080;"> (</span> &#8216;Produts 2&#8242;[Product] <span class="Parenthesis" style="color: #808080;">)</span>,<br />
<span class="indent8">        </span><span class="Number" style="color: #ee7f18;">0</span>,<br />
<span class="indent8">        </span><span class="Keyword" style="color: #035aca;">MAXX</span><span class="Parenthesis" style="color: #808080;"> (</span> <span class="Variable" style="color: #49b0af;">table1</span>, [SalesProducts] <span class="Parenthesis" style="color: #808080;">)</span><br />
<span class="indent4">    </span><span class="Parenthesis" style="color: #808080;">)</span></p>
<p>Total Sales Top Product =<br />
<span class="Keyword" style="color: #035aca;">VAR</span> <span class="Variable" style="color: #49b0af;">table1</span> =<br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">SUMMARIZE</span><span class="Parenthesis" style="color: #808080;"> (</span><br />
<span class="indent8">        </span>Sales,<br />
<span class="indent8">        </span>&#8216;Date'[Year],<br />
<span class="indent8">        </span>Products[ProductID],<br />
<span class="indent8">        </span><span class="StringLiteral" style="color: #d93124;">&#8220;SalesProducts&#8221;</span>, [Total Sales]<br />
<span class="indent4">    </span><span class="Parenthesis" style="color: #808080;">)</span><br />
<span class="Keyword" style="color: #035aca;">RETURN</span><br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">IF</span><span class="Parenthesis" style="color: #808080;"> (</span><br />
<span class="indent8">        </span>[TopProduct] = <span class="Keyword" style="color: #035aca;">SELECTEDVALUE</span><span class="Parenthesis" style="color: #808080;"> (</span> &#8216;Produts 2&#8242;[Product] <span class="Parenthesis" style="color: #808080;">)</span>,<br />
<span class="indent8">        </span><span class="Number" style="color: #ee7f18;">0</span>,<br />
<span class="indent8">        </span><span class="Keyword" style="color: #035aca;">MAXX</span><span class="Parenthesis" style="color: #808080;"> (</span> <span class="Variable" style="color: #49b0af;">table1</span>, [SalesProducts] <span class="Parenthesis" style="color: #808080;">)</span><br />
<span class="indent4">    </span><span class="Parenthesis" style="color: #808080;">)</span></p>
<p>Total Sales Other Products =<br />
[Total Sales] &#8211; [Total Sales Top Product] &#8211; [Total Sales Selected Product]</p>
<p>We place the last three measures on a stacked column chart under Value and drag Year into Axis. We make the [Total Sales Selected Product] green so that it stand out and the other two shades of grey. Now you can use the same filter from above to select a product and see in which years it is the top selling product. There are some products in the overall top 10 which were never the top selling product in any year.</p>
<p>&nbsp;</p>
<div style="width: 1080px;" class="wp-video"><video class="wp-video-shortcode" id="video-2212-4" width="1080" height="524" preload="metadata" controls="controls"><source type="video/mp4" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/show-top-10-products-visually.mp4?_=4" /><a href="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/show-top-10-products-visually.mp4">https://capstoneanalytics.com.au/wp-content/uploads/2020/04/show-top-10-products-visually.mp4</a></video></div>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-6-visually-showcasing-the-years-in-which-a-selected-product-is-the-top-product/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		<enclosure url="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/top-10-products.mp4" length="529019" type="video/mp4" />
<enclosure url="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/show-top-10-products-visually.mp4" length="160012" type="video/mp4" />

			</item>
		<item>
		<title>Master post for strategic colouring articles</title>
		<link>https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=master-post-for-strategic-colouring-articles</link>
					<comments>https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/#respond</comments>
		
		<dc:creator><![CDATA[Abhijith DSouza]]></dc:creator>
		<pubDate>Sun, 12 Apr 2020 04:40:59 +0000</pubDate>
				<category><![CDATA[Power BI]]></category>
		<category><![CDATA[DAX]]></category>
		<category><![CDATA[Selective Colouring]]></category>
		<category><![CDATA[Strategic Colouring]]></category>
		<guid isPermaLink="false">https://capstoneanalytics.com.au/?p=2207</guid>

					<description><![CDATA[This is a master post which contains all the links to strategic colouring articles. This post will be updated as new articles focusing on strategic colouring are posted. Link to github repo containing all the Power BI files also included in the end Part 1 &#8211; https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-1-comparing-different-metrics-across-a-common-dimension/ Part 2 &#8211; https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-2-comparing-a-trend-versus-the-rest/ Part 3 &#8211; https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-3-isolating-a-category-in-a-trend/ [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>This is a master post which contains all the links to strategic colouring articles. This post will be updated as new articles focusing on strategic colouring are posted. Link to github repo containing all the Power BI files also included in the end</p>
<p>Part 1 &#8211; <a href="https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-1-comparing-different-metrics-across-a-common-dimension/">https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-1-comparing-different-metrics-across-a-common-dimension/</a></p>
<p>Part 2 &#8211; <a href="https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-2-comparing-a-trend-versus-the-rest/">https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-2-comparing-a-trend-versus-the-rest/</a></p>
<p>Part 3 &#8211; <a href="https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-3-isolating-a-category-in-a-trend/">https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-3-isolating-a-category-in-a-trend/</a></p>
<p>Part 4- <a href="https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-4-isolating-and-visualising-ytd-data/">https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-4-isolating-and-visualising-ytd-data/</a></p>
<p>Part 5 &#8211;<a href="https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-5-difference-in-sales-from-a-base-year-for-different-segments/"> https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-5-difference-in-sales-from-a-base-year-for-different-segments/</a></p>
<p>Part 6 &#8211; <a href="https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-6-visually-showcasing-the-years-in-which-a-selected-product-is-the-top-product/">https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-6-visually-showcasing-the-years-in-which-a-selected-product-is-the-top-product/</a></p>
<p>Part 7 &#8211;<a href="https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-7-dynamically-plotting-yearly-percentage-sales-of-top-n-products-and-measuring-against-a-dynamic-target/"> https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-7-dynamically-plotting-yearly-percentage-sales-of-top-n-products-and-measuring-against-a-dynamic-target/</a></p>
<p>Part 8 &#8211; <a href="https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-8-transforming-a-stacked-column-chart-to-highlight-individual-series/">https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-8-transforming-a-stacked-column-chart-to-highlight-individual-series/</a></p>
<p>&nbsp;</p>
<p>Link to Github repo &#8211; <a href="https://github.com/capstoneanalytics/Power-BI-Strategic-Colouring">https://github.com/capstoneanalytics/Power-BI-Strategic-Colouring</a></p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Strategic colouring in Power BI – Part 5: Difference in sales from a base year for different segments</title>
		<link>https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-5-difference-in-sales-from-a-base-year-for-different-segments/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=strategic-colouring-in-power-bi-part-5-difference-in-sales-from-a-base-year-for-different-segments</link>
					<comments>https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-5-difference-in-sales-from-a-base-year-for-different-segments/#respond</comments>
		
		<dc:creator><![CDATA[Abhijith DSouza]]></dc:creator>
		<pubDate>Fri, 10 Apr 2020 04:04:54 +0000</pubDate>
				<category><![CDATA[Power BI]]></category>
		<category><![CDATA[DAX]]></category>
		<category><![CDATA[Selective Colouring]]></category>
		<category><![CDATA[Strategic Colouring]]></category>
		<guid isPermaLink="false">https://capstoneanalytics.com.au/?p=2200</guid>

					<description><![CDATA[This is the fifth post in the Strategic colouring in Power BI series. Links to all the posts can be found here https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/ In the fourth post, we discussed how to isolate and visualise YTD data In this post we will discuss how to visualise differences in sales for various categories in a field (Segment) [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>This is the fifth post in the Strategic colouring in Power BI series. Links to all the posts can be found here</p>
<p><a href="https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/">https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/</a></p>
<p>In the fourth <a href="https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-4-isolating-and-visualising-ytd-data/">post</a>, we discussed how to isolate and visualise YTD data</p>
<p>In this post we will discuss how to visualise differences in sales for various categories in a field (Segment) across all the years in a model from a base year.</p>
<p>Our model has one fact table Sales and two dimension tables Date and Product</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-2201" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/base-year-1.png" alt="" width="579" height="356" srcset="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/base-year-1.png 579w, https://capstoneanalytics.com.au/wp-content/uploads/2020/04/base-year-1-480x295.png 480w" sizes="auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 579px, 100vw" /></p>
<p>Define Total Sales as</p>
<p>Total Sales =<br />
<span class="Keyword" style="color: #035aca;">SUM</span><span class="Parenthesis" style="color: #808080;"> (</span> Sales[Revenue] <span class="Parenthesis" style="color: #808080;">)</span></p>
<p>Next we will create a copy of the Date table and call it Date 2 and define these three measures</p>
<p>SelectedBaseYear =<br />
<span class="Keyword" style="color: #035aca;">SELECTEDVALUE</span><span class="Parenthesis" style="color: #808080;"> (</span> &#8216;Date 2&#8242;[Year] <span class="Parenthesis" style="color: #808080;">)</span></p>
<p>BaseYearValue =<br />
<span class="Keyword" style="color: #035aca;">IF</span><span class="Parenthesis" style="color: #808080;"> (</span> [SelectedBaseYear] = <span class="Keyword" style="color: #035aca;">SELECTEDVALUE</span><span class="Parenthesis" style="color: #808080;"> (</span> &#8216;Date'[Year] <span class="Parenthesis" style="color: #808080;">)</span>, <span class="Number" style="color: #ee7f18;">0</span>, <span class="Keyword" style="color: #035aca;">BLANK</span><span class="Parenthesis" style="color: #808080;"> (</span><span class="Parenthesis" style="color: #808080;">)</span> <span class="Parenthesis" style="color: #808080;">)</span></p>
<p>BaseYearSales =<br />
<span class="Keyword" style="color: #035aca;">CALCULATE</span><span class="Parenthesis" style="color: #808080;"> (</span> [Total Sales], <span class="Keyword" style="color: #035aca;">TREATAS</span><span class="Parenthesis" style="color: #808080;"> (</span> <span class="Keyword" style="color: #035aca;">VALUES</span><span class="Parenthesis" style="color: #808080;"> (</span> &#8216;Date 2&#8242;[Year] <span class="Parenthesis" style="color: #808080;">)</span>, &#8216;Date'[Year] <span class="Parenthesis" style="color: #808080;">)</span> <span class="Parenthesis" style="color: #808080;">)</span></p>
<p>SelectedBaseYear gives the Year when selected from a slicer. BaseYearValue will be used to highlight the SelectedBaseYear in the chart. BaseYearSales gives the Total Sales for the SelectedBaseYear</p>
<p>Now we define the variance measures</p>
<p>VarianceFromBaseYearNegative =<br />
<span class="Keyword" style="color: #035aca;">VAR</span> <span class="Variable" style="color: #49b0af;">diff</span> = [Total Sales] &#8211; [BaseYearSales]<br />
<span class="Keyword" style="color: #035aca;">RETURN</span><br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">IF</span><span class="Parenthesis" style="color: #808080;"> (</span> <span class="Variable" style="color: #49b0af;">diff</span> &lt; <span class="Number" style="color: #ee7f18;">0</span>, <span class="Variable" style="color: #49b0af;">diff</span>, <span class="Number" style="color: #ee7f18;">0</span> <span class="Parenthesis" style="color: #808080;">)</span></p>
<p>VarianceFromBaseYearPositive =<br />
<span class="Keyword" style="color: #035aca;">VAR</span> <span class="Variable" style="color: #49b0af;">diff</span> = [Total Sales] &#8211; [BaseYearSales]<br />
<span class="Keyword" style="color: #035aca;">RETURN</span><br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">IF</span><span class="Parenthesis" style="color: #808080;"> (</span> <span class="Variable" style="color: #49b0af;">diff</span> &gt; <span class="Number" style="color: #ee7f18;">0</span>, <span class="Variable" style="color: #49b0af;">diff</span>, <span class="Number" style="color: #ee7f18;">0</span> <span class="Parenthesis" style="color: #808080;">)</span></p>
<p>We also need to calculate the Maximum and Minimum differences so that we can highlight them in the chart</p>
<p>MaxPositiveDifference =<br />
<span class="Keyword" style="color: #035aca;">VAR</span> <span class="Variable" style="color: #49b0af;">baseyearsales</span> = [BaseYearSales]<br />
<span class="Keyword" style="color: #035aca;">VAR</span> <span class="Variable" style="color: #49b0af;">result</span> =<br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">CALCULATE</span><span class="Parenthesis" style="color: #808080;"> (</span><br />
<span class="indent8">        </span><span class="Keyword" style="color: #035aca;">MAXX</span><span class="Parenthesis" style="color: #808080;"> (</span><br />
<span class="indent8">        </span><span class="indent4">    </span><span class="Keyword" style="color: #035aca;">SUMMARIZE</span><span class="Parenthesis" style="color: #808080;"> (</span> Sales, &#8216;Date'[Year], <span class="StringLiteral" style="color: #d93124;">&#8220;Variance&#8221;</span>, [Total Sales] &#8211; <span class="Variable" style="color: #49b0af;">baseyearsales</span> <span class="Parenthesis" style="color: #808080;">)</span>,<br />
<span class="indent8">        </span><span class="indent4">    </span>[Variance]<br />
<span class="indent8">        </span><span class="Parenthesis" style="color: #808080;">)</span>,<br />
<span class="indent8">        </span><span class="Keyword" style="color: #035aca;">ALL</span><span class="Parenthesis" style="color: #808080;"> (</span> &#8216;Date'[Year] <span class="Parenthesis" style="color: #808080;">)</span><br />
<span class="indent4">    </span><span class="Parenthesis" style="color: #808080;">)</span><br />
<span class="Keyword" style="color: #035aca;">RETURN</span><br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">IF</span><span class="Parenthesis" style="color: #808080;"> (</span> <span class="Variable" style="color: #49b0af;">result</span> = [VarianceFromBaseYearPositive], <span class="Variable" style="color: #49b0af;">result</span>, <span class="Number" style="color: #ee7f18;">0</span> <span class="Parenthesis" style="color: #808080;">)</span></p>
<p>&nbsp;</p>
<p>MaxNegativeDifference =<br />
<span class="Keyword" style="color: #035aca;">VAR</span> <span class="Variable" style="color: #49b0af;">baseyearsales</span> = [BaseYearSales]<br />
<span class="Keyword" style="color: #035aca;">VAR</span> <span class="Variable" style="color: #49b0af;">result</span> =<br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">CALCULATE</span><span class="Parenthesis" style="color: #808080;"> (</span><br />
<span class="indent8">        </span><span class="Keyword" style="color: #035aca;">MINX</span><span class="Parenthesis" style="color: #808080;"> (</span><br />
<span class="indent8">        </span><span class="indent4">    </span><span class="Keyword" style="color: #035aca;">SUMMARIZE</span><span class="Parenthesis" style="color: #808080;"> (</span> Sales, &#8216;Date'[Year], <span class="StringLiteral" style="color: #d93124;">&#8220;Variance&#8221;</span>, [Total Sales] &#8211; <span class="Variable" style="color: #49b0af;">baseyearsales</span> <span class="Parenthesis" style="color: #808080;">)</span>,<br />
<span class="indent8">        </span><span class="indent4">    </span>[Variance]<br />
<span class="indent8">        </span><span class="Parenthesis" style="color: #808080;">)</span>,<br />
<span class="indent8">        </span><span class="Keyword" style="color: #035aca;">ALL</span><span class="Parenthesis" style="color: #808080;"> (</span> &#8216;Date'[Year] <span class="Parenthesis" style="color: #808080;">)</span><br />
<span class="indent4">    </span><span class="Parenthesis" style="color: #808080;">)</span><br />
<span class="Keyword" style="color: #035aca;">RETURN</span><br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">IF</span><span class="Parenthesis" style="color: #808080;"> (</span> <span class="Variable" style="color: #49b0af;">result</span> = [VarianceFromBaseYearNegative], <span class="Variable" style="color: #49b0af;">result</span>, <span class="Number" style="color: #ee7f18;">0</span> <span class="Parenthesis" style="color: #808080;">)</span></p>
<p>Now we need to calculate two more measures so that we dont double up on the numbers</p>
<p>PositiveVarianceWithoutMax =<br />
<span class="Keyword" style="color: #035aca;">IF</span><span class="Parenthesis" style="color: #808080;"> (</span><br />
<span class="indent4">    </span>[VarianceFromBaseYearPositive] = [MaxPositiveDifference],<br />
<span class="indent4">    </span><span class="Number" style="color: #ee7f18;">0</span>,<br />
<span class="indent4">    </span>[VarianceFromBaseYearPositive]<br />
<span class="Parenthesis" style="color: #808080;">)</span></p>
<p>NegativeVarianceWithoutMax =<br />
<span class="Keyword" style="color: #035aca;">IF</span><span class="Parenthesis" style="color: #808080;"> (</span><br />
<span class="indent4">    </span>[VarianceFromBaseYearNegative] = [MaxNegativeDifference],<br />
<span class="indent4">    </span><span class="Number" style="color: #ee7f18;">0</span>,<br />
<span class="indent4">    </span>[VarianceFromBaseYearNegative]<br />
<span class="Parenthesis" style="color: #808080;">)</span></p>
<p>Drag a Line and Stacked Column chart into a blank canvas and drag the following fields (Year is from Date table)</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2202" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/base-year-2.png" alt="" width="251" height="444" /></p>
<p>The colours are formatted to something similar</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2203" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/base-year-3.png" alt="" width="202" height="364" /></p>
<p>Now drag Year from Date 2 table and drag it into a slicer and make it single select</p>
<p>Also drag Segment from Product table and drag it into a slicer and make it single select</p>
<p>Now you can select the Year which will serve as the Base Year and select different categories in the Segment field to look at the variances.</p>
<p>&nbsp;</p>
<div style="width: 1080px;" class="wp-video"><video class="wp-video-shortcode" id="video-2200-5" width="1080" height="615" preload="metadata" controls="controls"><source type="video/mp4" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/Difference-from-base-year.mp4?_=5" /><a href="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/Difference-from-base-year.mp4">https://capstoneanalytics.com.au/wp-content/uploads/2020/04/Difference-from-base-year.mp4</a></video></div>
<p>&nbsp;</p>
<p>Link to interactive report <a href="https://app.powerbi.com/view?r=eyJrIjoiNTFkYjE5Y2UtYzUzNi00YzJjLTgxZjktNDgyNGY5NTY0YWYxIiwidCI6IjZjZDI2M2IwLTQxNmItNGY5MC04ZDRmLTJmNmE1YjU2OGM1ZSJ9">here</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-5-difference-in-sales-from-a-base-year-for-different-segments/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		<enclosure url="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/Difference-from-base-year.mp4" length="253259" type="video/mp4" />

			</item>
		<item>
		<title>Strategic colouring in Power BI – Part 4: Isolating and visualising YTD data</title>
		<link>https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-4-isolating-and-visualising-ytd-data/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=strategic-colouring-in-power-bi-part-4-isolating-and-visualising-ytd-data</link>
					<comments>https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-4-isolating-and-visualising-ytd-data/#respond</comments>
		
		<dc:creator><![CDATA[Abhijith DSouza]]></dc:creator>
		<pubDate>Thu, 09 Apr 2020 03:47:51 +0000</pubDate>
				<category><![CDATA[Power BI]]></category>
		<category><![CDATA[DAX]]></category>
		<category><![CDATA[Selective Colouring]]></category>
		<category><![CDATA[Strategic Colouring]]></category>
		<category><![CDATA[YTD]]></category>
		<guid isPermaLink="false">https://capstoneanalytics.com.au/?p=2190</guid>

					<description><![CDATA[This is the fourth post in the Strategic colouring in Power BI series. Links to all the posts can be found here https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/ In the previous post, we looked at how to isolate a category in a trend We will add on this in this post and see how to isolate and visualise YTD data. [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>This is the fourth post in the Strategic colouring in Power BI series. Links to all the posts can be found here</p>
<p><a href="https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/">https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/</a></p>
<p>In the previous <a href="https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-3-isolating-a-category-in-a-trend/">post,</a> we looked at how to isolate a category in a trend</p>
<p>We will add on this in this post and see how to isolate and visualise YTD data.</p>
<p>We have a simple data model with a sales table and a date table. There is sales data for 16 years in the model and we want to visualise the YTD performance for each year.</p>
<p>We define two measure as follows</p>
<p>Total Sales =<br />
<span class="Keyword" style="color: #035aca;">SUM</span><span class="Parenthesis" style="color: #808080;"> (</span> Sales[Revenue] <span class="Parenthesis" style="color: #808080;">)</span></p>
<p>YTD Sales =<br />
<span class="Keyword" style="color: #035aca;">TOTALYTD</span><span class="Parenthesis" style="color: #808080;"> (</span> [Total Sales], &#8216;Date'[Date] <span class="Parenthesis" style="color: #808080;">)</span></p>
<p>Next drag a line chart into the canvas and drag Date into Axis and [YTD Sales] into Values. The chart looks like this</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2191" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/YTD1.png" alt="" width="630" height="366" srcset="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/YTD1.png 630w, https://capstoneanalytics.com.au/wp-content/uploads/2020/04/YTD1-480x279.png 480w" sizes="auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 630px, 100vw" /></p>
<p>Not quite what we wanted but the chart does exactly what its supposed to be doing. It calculates the YTD for year 2000 and when it reaches January 1 2001 it resets and starts from 0 and continues for the next year. This happens for all the years in the model.</p>
<p>What we want is a chart which show the YTD for each year starting from 0 so that they can be compared against each other. We can easily achieve this. Remove the Date filed and drag MonthName into the Axis and drag Year into Legend. The chart looks like this</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2192" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/YTD2.png" alt="" width="653" height="350" srcset="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/YTD2.png 653w, https://capstoneanalytics.com.au/wp-content/uploads/2020/04/YTD2-480x257.png 480w" sizes="auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 653px, 100vw" /></p>
<p>This is exactly what we were after. Each YTD starts at 0 and now we can compare the performance of each years&#8217; YTD against the other years. But the problem is there is too much data and its hard to focus on one year.</p>
<p>This is where we apply the concepts of strategic colouring. For this we need to define a measure to calculate the YTD for each year. For ex</p>
<p>YTD Sales 2000 =<br />
<span class="Keyword" style="color: #035aca;">VAR</span> <span class="Variable" style="color: #49b0af;">selyear</span> = <span class="Number" style="color: #ee7f18;">2000</span><br />
<span class="Keyword" style="color: #035aca;">RETURN</span><br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">IF</span><span class="Parenthesis" style="color: #808080;"> (</span><br />
<span class="indent8">        </span><span class="Variable" style="color: #49b0af;">selyear</span> <span class="Keyword" style="color: #035aca;">IN</span> <span class="Keyword" style="color: #035aca;">VALUES</span><span class="Parenthesis" style="color: #808080;"> (</span> &#8216;Date'[Year] <span class="Parenthesis" style="color: #808080;">)</span>,<br />
<span class="indent8">        </span><span class="Keyword" style="color: #035aca;">CALCULATE</span><span class="Parenthesis" style="color: #808080;"> (</span> [YTD Sales], &#8216;Date'[Year] = <span class="Variable" style="color: #49b0af;">selyear</span> <span class="Parenthesis" style="color: #808080;">)</span>,<br />
<span class="indent8">        </span><span class="Keyword" style="color: #035aca;">BLANK</span><span class="Parenthesis" style="color: #808080;"> (</span><span class="Parenthesis" style="color: #808080;">)</span><br />
<span class="indent4">    </span><span class="Parenthesis" style="color: #808080;">)</span></p>
<p>Use the logic above and calculate YTD for all the years for which there is Sales in the model. This has to be done manually currently, hopefully with the introduction of calculated groups this can be automated in the future. In our case we have defined 16 YTD measures from 2000 to 2015</p>
<p>Create a copy of the Date table and call it Date 2. Next define this measure</p>
<p>TotalSalesAmountSelectedYear =<br />
<span class="Keyword" style="color: #035aca;">IF</span><span class="Parenthesis" style="color: #808080;"> (</span><br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">ISFILTERED</span><span class="Parenthesis" style="color: #808080;"> (</span> &#8216;Date 2&#8242;[Year] <span class="Parenthesis" style="color: #808080;">)</span>,<br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">CALCULATE</span><span class="Parenthesis" style="color: #808080;"> (</span> [YTD Sales], <span class="Keyword" style="color: #035aca;">TREATAS</span><span class="Parenthesis" style="color: #808080;"> (</span> <span class="Keyword" style="color: #035aca;">VALUES</span><span class="Parenthesis" style="color: #808080;"> (</span> &#8216;Date 2&#8242;[Year] <span class="Parenthesis" style="color: #808080;">)</span>, &#8216;Date'[Year] <span class="Parenthesis" style="color: #808080;">)</span> <span class="Parenthesis" style="color: #808080;">)</span>,<br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">BLANK</span><span class="Parenthesis" style="color: #808080;"> (</span><span class="Parenthesis" style="color: #808080;">)</span><br />
<span class="Parenthesis" style="color: #808080;">)</span></p>
<p>In the line chart above remove the Year from legend and drag the 16 measures and the above measures into Values and make the colour of the 16 YTD measures as grey and the above measure as green</p>
<p>Next drag Year from Date 2 table into a slicer and with some formatting the chart should look like this when Year 2000 is selected</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-2193" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/YTD3.png" alt="" width="834" height="463" /></p>
<p>&nbsp;</p>
<p>We can to one step further and pick the range of years we want to analyse. For this place the Year from Date table into another slicer and place it above the slicer created above. We can now narrow down our focus by selecting range of years in the first slicer. We also want to make sure that when we select a range the second slicer is also filtered. For this we define a measure called</p>
<p>FilteredYear =<br />
<span class="Keyword" style="color: #035aca;">VAR</span> <span class="Variable" style="color: #49b0af;">selyear</span> =<br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">VALUES</span><span class="Parenthesis" style="color: #808080;"> (</span> &#8216;Date'[Year] <span class="Parenthesis" style="color: #808080;">)</span><br />
<span class="Keyword" style="color: #035aca;">RETURN</span><br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">IF</span><span class="Parenthesis" style="color: #808080;"> (</span> <span class="Keyword" style="color: #035aca;">MAX</span><span class="Parenthesis" style="color: #808080;"> (</span> &#8216;Date 2&#8242;[Year] <span class="Parenthesis" style="color: #808080;">)</span> <span class="Keyword" style="color: #035aca;">IN</span> <span class="Variable" style="color: #49b0af;">selyear</span>, <span class="Number" style="color: #ee7f18;">1</span>, <span class="Number" style="color: #ee7f18;">0</span> <span class="Parenthesis" style="color: #808080;">)</span></p>
<p>Place this measure as a filter on the bottom slicer and set it to be equal to 1<img loading="lazy" decoding="async" class="alignnone wp-image-2194" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/YTD4.png" alt="" width="741" height="256" />.</p>
<p>Now whenever the range in the top slicer changes it will filter the bottom slicer. You can then chose the year from the bottom slicer to isolate the YTD for the year of your choice.<br />
Add some text for user prompt and the final setup looks like this after a few selections are made</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-2195" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/YTD5.png" alt="" width="825" height="432" /></p>
<p>&nbsp;</p>
<p>Link to interactive report <a href="https://app.powerbi.com/view?r=eyJrIjoiNDIzNDAzN2EtNzM2Mi00NjA0LThjYzItZjVlZDAyYWY1MDhjIiwidCI6IjZjZDI2M2IwLTQxNmItNGY5MC04ZDRmLTJmNmE1YjU2OGM1ZSJ9">here</a></p>
<div style="width: 1080px;" class="wp-video"><video class="wp-video-shortcode" id="video-2190-6" width="1080" height="624" preload="metadata" controls="controls"><source type="video/mp4" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/Strategic-colour-YTD.mp4?_=6" /><a href="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/Strategic-colour-YTD.mp4">https://capstoneanalytics.com.au/wp-content/uploads/2020/04/Strategic-colour-YTD.mp4</a></video></div>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-4-isolating-and-visualising-ytd-data/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		<enclosure url="https://capstoneanalytics.com.au/wp-content/uploads/2020/04/Strategic-colour-YTD.mp4" length="465041" type="video/mp4" />

			</item>
		<item>
		<title>Strategic colouring in Power BI – Part 3: Isolating a category in a trend</title>
		<link>https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-3-isolating-a-category-in-a-trend/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=strategic-colouring-in-power-bi-part-3-isolating-a-category-in-a-trend</link>
					<comments>https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-3-isolating-a-category-in-a-trend/#respond</comments>
		
		<dc:creator><![CDATA[Abhijith DSouza]]></dc:creator>
		<pubDate>Fri, 20 Mar 2020 00:27:30 +0000</pubDate>
				<category><![CDATA[Power BI]]></category>
		<category><![CDATA[DAX]]></category>
		<category><![CDATA[Selective Colouring]]></category>
		<category><![CDATA[Strategic Colouring]]></category>
		<guid isPermaLink="false">https://capstoneanalytics.com.au/?p=2148</guid>

					<description><![CDATA[This is the third post in the Strategic colouring in Power BI series. Links to all the posts can be found here https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/ In the previous post we saw how to compare a trend of one or multiple category in a field versus the rest of the categories. In this part we will see how [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>This is the third post in the Strategic colouring in Power BI series. Links to all the posts can be found here</p>
<p><a href="https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/">https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/</a></p>
<p>In the previous <a href="https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-2-comparing-a-trend-versus-the-rest/">post</a> we saw how to compare a trend of one or multiple category in a field versus the rest of the categories.</p>
<p>In this part we will see how to isolate a category in a trend</p>
<p>For this we need two measures and one new table</p>
<p>Define a new table as folllows</p>
<p>ProductSize =<br />
<span class="Keyword" style="color: #0070ff;">VALUES</span><span class="Parenthesis" style="color: #969696;"> (</span> dimProduct[Size] <span class="Parenthesis" style="color: #969696;">)</span></p>
<p>Define the two measures as follows</p>
<p>TotalSalesAmount =<br />
<span class="Keyword" style="color: #0070ff;">SUM</span><span class="Parenthesis" style="color: #969696;"> (</span> fctSales[SalesAmount] <span class="Parenthesis" style="color: #969696;">)</span></p>
<p>TotalSalesAmountSelectedSize =<br />
<span class="Keyword" style="color: #0070ff;">IF</span><span class="Parenthesis" style="color: #969696;"> (</span><br />
<span class="indent4">    </span><span class="Keyword" style="color: #0070ff;">ISFILTERED</span><span class="Parenthesis" style="color: #969696;"> (</span> ProductSize[Size] <span class="Parenthesis" style="color: #969696;">)</span>,<br />
<span class="indent4">    </span><span class="Keyword" style="color: #0070ff;">CALCULATE</span><span class="Parenthesis" style="color: #969696;"> (</span><br />
<span class="indent8">        </span>[TotalSalesAmount],<br />
<span class="indent8">        </span><span class="Keyword" style="color: #0070ff;">TREATAS</span><span class="Parenthesis" style="color: #969696;"> (</span> <span class="Keyword" style="color: #0070ff;">VALUES</span><span class="Parenthesis" style="color: #969696;"> (</span> ProductSize[Size] <span class="Parenthesis" style="color: #969696;">)</span>, dimProduct[Size] <span class="Parenthesis" style="color: #969696;">)</span><br />
<span class="indent4">    </span><span class="Parenthesis" style="color: #969696;">)</span>,<br />
<span class="indent4">    </span><span class="Keyword" style="color: #0070ff;">BLANK</span><span class="Parenthesis" style="color: #969696;"> (</span><span class="Parenthesis" style="color: #969696;">)</span><br />
<span class="Parenthesis" style="color: #969696;">)</span></p>
<p>Now we are ready to visualise</p>
<p>In a line chart Drag Monthname into Axis and [TotalSalesAmount] into Values and dimProduct[Size] into Legend. Make the colours of all the lines grey and under Format-&gt; Y axis change start to 0 and End to 500000. This way we are defining the start and end points and they do not change</p>
<p>Copy the visual. Remove the legend and Values and drag [TotalSalesAmountSelectedSize] into Values. Make the colour a bit brighter like green or blue.</p>
<p>Now here is the hack to make it work. Click on the first visual and under Format-&gt; General, note the values. They will be something like this</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2151" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/03/isolating-category-General-settings.png" alt="" width="287" height="297" /></p>
<p>Now select the second visuals and copy &#8211; paste the values from above into the Format-&gt; General section. Now both the visuals are on top of the other. You have to make sure that the second visual is in front and the first one is at the back. You can use the Format &#8211; Bring forward/Bring backward to achieve this.</p>
<p>Next drag the  ProductSize[Size] into a slicer visual and make it single select. Happy interrogating !</p>
<p>&nbsp;</p>
<div style="width: 1080px;" class="wp-video"><video class="wp-video-shortcode" id="video-2148-7" width="1080" height="565" preload="metadata" controls="controls"><source type="video/mp4" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/03/Strategic-colour-part-3.mp4?_=7" /><a href="https://capstoneanalytics.com.au/wp-content/uploads/2020/03/Strategic-colour-part-3.mp4">https://capstoneanalytics.com.au/wp-content/uploads/2020/03/Strategic-colour-part-3.mp4</a></video></div>
]]></content:encoded>
					
					<wfw:commentRss>https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-3-isolating-a-category-in-a-trend/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		<enclosure url="https://capstoneanalytics.com.au/wp-content/uploads/2020/03/Strategic-colour-part-3.mp4" length="140432" type="video/mp4" />

			</item>
		<item>
		<title>Strategic colouring in Power BI – Part 2: Comparing a trend versus the rest</title>
		<link>https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-2-comparing-a-trend-versus-the-rest/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=strategic-colouring-in-power-bi-part-2-comparing-a-trend-versus-the-rest</link>
					<comments>https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-2-comparing-a-trend-versus-the-rest/#respond</comments>
		
		<dc:creator><![CDATA[Abhijith DSouza]]></dc:creator>
		<pubDate>Thu, 19 Mar 2020 00:09:13 +0000</pubDate>
				<category><![CDATA[Power BI]]></category>
		<category><![CDATA[DAX]]></category>
		<category><![CDATA[Selective Colouring]]></category>
		<category><![CDATA[Strategic Colouring]]></category>
		<guid isPermaLink="false">https://capstoneanalytics.com.au/?p=2142</guid>

					<description><![CDATA[This is the second post in the Strategic colouring in Power BI series. Links to all the posts can be found here https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/ In the first post, we discussed how to use strategic colouring to compare different metrics over a common dimension. In this part I will talk about how to compare a trend of one [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>This is the second post in the Strategic colouring in Power BI series. Links to all the posts can be found here</p>
<p><a href="https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/">https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/</a></p>
<p>In the first <a href="https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-1-comparing-different-metrics-across-a-common-dimension/">post,</a> we discussed how to use strategic colouring to compare different metrics over a common dimension.</p>
<p>In this part I will talk about how to compare a trend of one or multiple category in a field versus the rest of the categories.</p>
<p>We will use the same dataset as in the previous part for continuity. Define 3 measures as follows</p>
<p>TotalSalesAmount =<br />
<span class="Keyword" style="color: #0070ff;">SUM</span><span class="Parenthesis" style="color: #969696;"> (</span> fctSales[SalesAmount] <span class="Parenthesis" style="color: #969696;">)</span></p>
<p>TotalSalesAmountALLSize =<br />
<span class="Keyword" style="color: #0070ff;">CALCULATE</span><span class="Parenthesis" style="color: #969696;"> (</span> [TotalSalesAmount], <span class="Keyword" style="color: #0070ff;">ALL</span><span class="Parenthesis" style="color: #969696;"> (</span> dimProduct[Size] <span class="Parenthesis" style="color: #969696;">)</span> <span class="Parenthesis" style="color: #969696;">)</span></p>
<p>TotalSalesAmountRest =<br />
[TotalSalesAmountALLSize] &#8211; [TotalSalesAmount]</p>
<p>Drag the stacked area chart into the canvas and place MonthName in Axis and  [TotalSalesAmount] and [TotalSalesAmountRest] measures in Values. Change the colour of [TotalSalesAmountRest] to grey and [TotalSalesAmount] to a brighter colour say green or blue</p>
<p>Drag Sizze from DimProduct into a Slicer visual and start interrogating the data.</p>
<p>&nbsp;</p>
<div style="width: 1080px;" class="wp-video"><video class="wp-video-shortcode" id="video-2142-8" width="1080" height="555" preload="metadata" controls="controls"><source type="video/mp4" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/03/Straegic-colour-Part-2.mp4?_=8" /><a href="https://capstoneanalytics.com.au/wp-content/uploads/2020/03/Straegic-colour-Part-2.mp4">https://capstoneanalytics.com.au/wp-content/uploads/2020/03/Straegic-colour-Part-2.mp4</a></video></div>
]]></content:encoded>
					
					<wfw:commentRss>https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-2-comparing-a-trend-versus-the-rest/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		<enclosure url="https://capstoneanalytics.com.au/wp-content/uploads/2020/03/Straegic-colour-Part-2.mp4" length="270640" type="video/mp4" />

			</item>
		<item>
		<title>Strategic colouring in Power BI – Part 1: Comparing different metrics across a common dimension</title>
		<link>https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-1-comparing-different-metrics-across-a-common-dimension/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=strategic-colouring-in-power-bi-part-1-comparing-different-metrics-across-a-common-dimension</link>
					<comments>https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-1-comparing-different-metrics-across-a-common-dimension/#comments</comments>
		
		<dc:creator><![CDATA[Abhijith DSouza]]></dc:creator>
		<pubDate>Thu, 12 Mar 2020 23:41:46 +0000</pubDate>
				<category><![CDATA[Power BI]]></category>
		<category><![CDATA[DAX]]></category>
		<category><![CDATA[Selective Colouring]]></category>
		<category><![CDATA[Strategic Colouring]]></category>
		<guid isPermaLink="false">https://capstoneanalytics.com.au/?p=2138</guid>

					<description><![CDATA[This is the first post in the Strategic colouring in Power BI series. Links to all the posts can be found here https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/ So you work in Sales. You want to compare revenue, profit, tax amount over the different business units. You want to see the relative position of a business unit over the other [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>This is the first post in the Strategic colouring in Power BI series. Links to all the posts can be found here</p>
<p><a href="https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/">https://capstoneanalytics.com.au/master-post-for-strategic-colouring-articles/</a></p>
<p>So you work in Sales. You want to compare revenue, profit, tax amount over the different business units. You want to see the relative position of a business unit over the other units for the three metrics . How would you do it ? This was precisely what one of our client was after. The following is a solution we provided. The Adventureworks dataset is used in this article to explain the concepts.</p>
<p>We will be visualising SalesAmount, OrderQuantity, and TaxAmt over the Product Size. I have chosen Product Size as the common dimension as there are more than 10 sizes and thus helps to get the point across.</p>
<p>Define 3 measures for the three metrics as follows</p>
<p>TotalSalesAmount =<br />
<span class="Keyword" style="color: #0070ff;">SUM (</span>  fctSales[SalesAmount] <span class="Parenthesis" style="color: #969696;">)</span></p>
<p>TotalOrderQuantity =<br />
<span class="Keyword" style="color: #0070ff;">SUM</span><span class="Parenthesis" style="color: #969696;"> (</span> fctSales[OrderQuantity] <span class="Parenthesis" style="color: #969696;">)</span></p>
<p>TotalTaxAmount =<br />
<span class="Keyword" style="color: #0070ff;">SUM</span><span class="Parenthesis" style="color: #969696;"> (</span> fctSales[TaxAmt] <span class="Parenthesis" style="color: #969696;">)</span></p>
<p>Next create a new table called ProductSize as follows. The column size will be used as a slicer in our report</p>
<p>ProductSize =<br />
<span class="Keyword" style="color: #0070ff;">VALUES</span><span class="Parenthesis" style="color: #969696;"> (</span> dimProduct[Size] <span class="Parenthesis" style="color: #969696;">)</span></p>
<p>Next place a clustered bar chart on a blank page. Drag DimProduct[Size] into the Axis field and drag [TotalSalesAmount] into the Vaue field. Make the data colour &#8220;#E6E6E6&#8221;. Go to the Analytics pane on the visual and add an Average line and show labels.</p>
<p>Repeat the above for [TotalOrderQuantity] and [TotalTaxAmount]. Your canvas should look like this</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2128" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/03/strategic-canvas-charts.png" alt="" width="1141" height="664" srcset="https://capstoneanalytics.com.au/wp-content/uploads/2020/03/strategic-canvas-charts.png 1141w, https://capstoneanalytics.com.au/wp-content/uploads/2020/03/strategic-canvas-charts-980x570.png 980w, https://capstoneanalytics.com.au/wp-content/uploads/2020/03/strategic-canvas-charts-480x279.png 480w" sizes="auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1141px, 100vw" /></p>
<p>The aim is to apply conditional formatting on the bars so that it gives different colours when a bar is above or below the average, We need to define three measures to calculate the averages.</p>
<p>Average Sales =<br />
<span class="Keyword" style="color: #0070ff;">CALCULATE</span><span class="Parenthesis" style="color: #969696;"> (</span><br />
<span class="indent4">    </span><span class="Keyword" style="color: #0070ff;">AVERAGEX</span><span class="Parenthesis" style="color: #969696;"> (</span><br />
<span class="indent8">        </span><span class="Keyword" style="color: #0070ff;">SUMMARIZE</span><span class="Parenthesis" style="color: #969696;"> (</span> fctSales, dimProduct[Size], <span class="StringLiteral" style="color: #d93124;">&#8220;SalesTotal&#8221;</span>, [TotalSalesAmount] <span class="Parenthesis" style="color: #969696;">)</span>,<br />
<span class="indent8">        </span>[SalesTotal]<br />
<span class="indent4">    </span><span class="Parenthesis" style="color: #969696;">)</span>,<br />
<span class="indent4">    </span><span class="Keyword" style="color: #0070ff;">ALL</span><span class="Parenthesis" style="color: #969696;"> (</span> dimProduct[Size] <span class="Parenthesis" style="color: #969696;">)</span>,<br />
<span class="indent4">    </span><span class="Keyword" style="color: #0070ff;">NOT</span><span class="Parenthesis" style="color: #969696;"> (</span> <span class="Keyword" style="color: #0070ff;">ISBLANK</span><span class="Parenthesis" style="color: #969696;"> (</span> dimProduct[Size] <span class="Parenthesis" style="color: #969696;">)</span> <span class="Parenthesis" style="color: #969696;">)</span><br />
<span class="Parenthesis" style="color: #969696;">)</span></p>
<p>&nbsp;</p>
<p>Average Orderquantity =<br />
<span class="Keyword" style="color: #0070ff;">CALCULATE</span><span class="Parenthesis" style="color: #969696;"> (</span><br />
<span class="indent4">    </span><span class="Keyword" style="color: #0070ff;">AVERAGEX</span><span class="Parenthesis" style="color: #969696;"> (</span><br />
<span class="indent8">        </span><span class="Keyword" style="color: #0070ff;">SUMMARIZE</span><span class="Parenthesis" style="color: #969696;"> (</span> fctSales, dimProduct[Size], <span class="StringLiteral" style="color: #d93124;">&#8220;QuantityTotal&#8221;</span>, [TotalOrderQuantity] <span class="Parenthesis" style="color: #969696;">)</span>,<br />
<span class="indent8">        </span>[QuantityTotal]<br />
<span class="indent4">    </span><span class="Parenthesis" style="color: #969696;">)</span>,<br />
<span class="indent4">    </span><span class="Keyword" style="color: #0070ff;">ALL</span><span class="Parenthesis" style="color: #969696;"> (</span> dimProduct[Size] <span class="Parenthesis" style="color: #969696;">)</span>,<br />
<span class="indent4">    </span><span class="Keyword" style="color: #0070ff;">NOT</span><span class="Parenthesis" style="color: #969696;"> (</span> <span class="Keyword" style="color: #0070ff;">ISBLANK</span><span class="Parenthesis" style="color: #969696;"> (</span> dimProduct[Size] <span class="Parenthesis" style="color: #969696;">)</span> <span class="Parenthesis" style="color: #969696;">)</span><br />
<span class="Parenthesis" style="color: #969696;">)</span></p>
<p>&nbsp;</p>
<p>Average Tax =<br />
<span class="Keyword" style="color: #0070ff;">CALCULATE</span><span class="Parenthesis" style="color: #969696;"> (</span><br />
<span class="indent4">    </span><span class="Keyword" style="color: #0070ff;">AVERAGEX</span><span class="Parenthesis" style="color: #969696;"> (</span><br />
<span class="indent8">        </span><span class="Keyword" style="color: #0070ff;">SUMMARIZE</span><span class="Parenthesis" style="color: #969696;"> (</span> fctSales, dimProduct[Size], <span class="StringLiteral" style="color: #d93124;">&#8220;TaxTotal&#8221;</span>, [TotalTaxAmount] <span class="Parenthesis" style="color: #969696;">)</span>,<br />
<span class="indent8">        </span>[TaxTotal]<br />
<span class="indent4">    </span><span class="Parenthesis" style="color: #969696;">)</span>,<br />
<span class="indent4">    </span><span class="Keyword" style="color: #0070ff;">ALL</span><span class="Parenthesis" style="color: #969696;"> (</span> dimProduct[Size] <span class="Parenthesis" style="color: #969696;">)</span>,<br />
<span class="indent4">    </span><span class="Keyword" style="color: #0070ff;">NOT</span><span class="Parenthesis" style="color: #969696;"> (</span> <span class="Keyword" style="color: #0070ff;">ISBLANK</span><span class="Parenthesis" style="color: #969696;"> (</span> dimProduct[Size] <span class="Parenthesis" style="color: #969696;">)</span> <span class="Parenthesis" style="color: #969696;">)</span><br />
<span class="Parenthesis" style="color: #969696;">)</span></p>
<p>The <span class="Keyword" style="color: #0070ff;">NOT</span><span class="Parenthesis" style="color: #969696;"> (</span> <span class="Keyword" style="color: #0070ff;">ISBLANK</span><span class="Parenthesis" style="color: #969696;"> (</span> dimProduct[Size] <span class="Parenthesis" style="color: #969696;">)</span> <span class="Parenthesis" style="color: #969696;">) </span> is used as I want to remove all the sizes which dont have a value in them</p>
<p>Next we will be defining three measures to get the right colours for the bars</p>
<p>SalesColour =<br />
<span class="Keyword" style="color: #0070ff;">VAR</span> <span class="Variable" style="color: #49b0af;">selsize</span> =<br />
<span class="indent4">    </span><span class="Keyword" style="color: #0070ff;">SELECTEDVALUE</span><span class="Parenthesis" style="color: #969696;"> (</span> ProductSize[Size] <span class="Parenthesis" style="color: #969696;">)</span><br />
<span class="Keyword" style="color: #0070ff;">RETURN</span><br />
<span class="indent4">    </span><span class="Keyword" style="color: #0070ff;">IF</span><span class="Parenthesis" style="color: #969696;"> (</span><br />
<span class="indent8">        </span><span class="Keyword" style="color: #0070ff;">SELECTEDVALUE</span><span class="Parenthesis" style="color: #969696;"> (</span> dimProduct[Size] <span class="Parenthesis" style="color: #969696;">)</span> = <span class="Variable" style="color: #49b0af;">selsize</span><br />
<span class="indent8">        </span><span class="indent4">    </span>&amp;&amp; [TotalSalesAmount] &lt; [Average Sales],<br />
<span class="indent8">        </span><span class="StringLiteral" style="color: #d93124;">&#8220;#FD625E&#8221;</span>,<br />
<span class="indent8">        </span><span class="Keyword" style="color: #0070ff;">IF</span><span class="Parenthesis" style="color: #969696;"> (</span><br />
<span class="indent8">        </span><span class="indent4">    </span><span class="Keyword" style="color: #0070ff;">SELECTEDVALUE</span><span class="Parenthesis" style="color: #969696;"> (</span> dimProduct[Size] <span class="Parenthesis" style="color: #969696;">)</span> = <span class="Variable" style="color: #49b0af;">selsize</span><br />
<span class="indent8">        </span><span class="indent8">        </span>&amp;&amp; [TotalSalesAmount] &gt; [Average Sales],<br />
<span class="indent8">        </span><span class="indent4">    </span><span class="StringLiteral" style="color: #d93124;">&#8220;#003DFF&#8221;</span>,<br />
<span class="indent8">        </span><span class="indent4">    </span><span class="StringLiteral" style="color: #d93124;">&#8220;#E6E6E6&#8221;</span><br />
<span class="indent8">        </span><span class="Parenthesis" style="color: #969696;">)</span><br />
<span class="indent4">    </span><span class="Parenthesis" style="color: #969696;">)</span></p>
<p>OrderQuantityColour =<br />
<span class="Keyword" style="color: #0070ff;">VAR</span> <span class="Variable" style="color: #49b0af;">selsize</span> =<br />
<span class="indent4">    </span><span class="Keyword" style="color: #0070ff;">SELECTEDVALUE</span><span class="Parenthesis" style="color: #969696;"> (</span> ProductSize[Size] <span class="Parenthesis" style="color: #969696;">)</span><br />
<span class="Keyword" style="color: #0070ff;">RETURN</span><br />
<span class="indent4">    </span><span class="Keyword" style="color: #0070ff;">IF</span><span class="Parenthesis" style="color: #969696;"> (</span><br />
<span class="indent8">        </span><span class="Keyword" style="color: #0070ff;">SELECTEDVALUE</span><span class="Parenthesis" style="color: #969696;"> (</span> dimProduct[Size] <span class="Parenthesis" style="color: #969696;">)</span> = <span class="Variable" style="color: #49b0af;">selsize</span><br />
<span class="indent8">        </span><span class="indent4">    </span>&amp;&amp; [TotalOrderQuantity] &lt; [Average Orderquantity],<br />
<span class="indent8">        </span><span class="StringLiteral" style="color: #d93124;">&#8220;#FD625E&#8221;</span>,<br />
<span class="indent8">        </span><span class="Keyword" style="color: #0070ff;">IF</span><span class="Parenthesis" style="color: #969696;"> (</span><br />
<span class="indent8">        </span><span class="indent4">    </span><span class="Keyword" style="color: #0070ff;">SELECTEDVALUE</span><span class="Parenthesis" style="color: #969696;"> (</span> dimProduct[Size] <span class="Parenthesis" style="color: #969696;">)</span> = <span class="Variable" style="color: #49b0af;">selsize</span><br />
<span class="indent8">        </span><span class="indent8">        </span>&amp;&amp; [TotalOrderQuantity] &gt; [Average Orderquantity],<br />
<span class="indent8">        </span><span class="indent4">    </span><span class="StringLiteral" style="color: #d93124;">&#8220;#003DFF&#8221;</span>,<br />
<span class="indent8">        </span><span class="indent4">    </span><span class="StringLiteral" style="color: #d93124;">&#8220;#E6E6E6&#8221;</span><br />
<span class="indent8">        </span><span class="Parenthesis" style="color: #969696;">)</span><br />
<span class="indent4">    </span><span class="Parenthesis" style="color: #969696;">)</span></p>
<p>TaxColour =<br />
<span class="Keyword" style="color: #0070ff;">VAR</span> <span class="Variable" style="color: #49b0af;">selsize</span> =<br />
<span class="indent4">    </span><span class="Keyword" style="color: #0070ff;">SELECTEDVALUE</span><span class="Parenthesis" style="color: #969696;"> (</span> ProductSize[Size] <span class="Parenthesis" style="color: #969696;">)</span><br />
<span class="Keyword" style="color: #0070ff;">RETURN</span><br />
<span class="indent4">    </span><span class="Keyword" style="color: #0070ff;">IF</span><span class="Parenthesis" style="color: #969696;"> (</span><br />
<span class="indent8">        </span><span class="Keyword" style="color: #0070ff;">SELECTEDVALUE</span><span class="Parenthesis" style="color: #969696;"> (</span> dimProduct[Size] <span class="Parenthesis" style="color: #969696;">)</span> = <span class="Variable" style="color: #49b0af;">selsize</span><br />
<span class="indent8">        </span><span class="indent4">    </span>&amp;&amp; [TotalTaxAmount] &lt; [Average Tax],<br />
<span class="indent8">        </span><span class="StringLiteral" style="color: #d93124;">&#8220;#FD625E&#8221;</span>,<br />
<span class="indent8">        </span><span class="Keyword" style="color: #0070ff;">IF</span><span class="Parenthesis" style="color: #969696;"> (</span><br />
<span class="indent8">        </span><span class="indent4">    </span><span class="Keyword" style="color: #0070ff;">SELECTEDVALUE</span><span class="Parenthesis" style="color: #969696;"> (</span> dimProduct[Size] <span class="Parenthesis" style="color: #969696;">)</span> = <span class="Variable" style="color: #49b0af;">selsize</span><br />
<span class="indent8">        </span><span class="indent8">        </span>&amp;&amp; [TotalTaxAmount] &gt; [Average Tax],<br />
<span class="indent8">        </span><span class="indent4">    </span><span class="StringLiteral" style="color: #d93124;">&#8220;#003DFF&#8221;</span>,<br />
<span class="indent8">        </span><span class="indent4">    </span><span class="StringLiteral" style="color: #d93124;">&#8220;#E6E6E6&#8221;</span><br />
<span class="indent8">        </span><span class="Parenthesis" style="color: #969696;">)</span><br />
<span class="indent4">    </span><span class="Parenthesis" style="color: #969696;">)</span></p>
<p>&nbsp;</p>
<p>Now we are ready to apply conditional formatting. Select the first chart on the canvas and under Format go to Data colours and click on the three dots under Default colour and click conditional formatting. In the window that comes up select the following options and click OK</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-2130" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/03/sel-color-cond-form.png" alt="" width="447" height="316" /></p>
<p>Repeat the above procedure for the second and third chart and replace SalesColour by OrderColour and TaxColour respectively</p>
<p>The charts are now conditionally formatted. Drag a slicer into the canvas and make it Single select. Drag ProductSize[Size] into the canvas (Remember to drag the right size column, the DimProduct[Size] should not be dragged here).</p>
<p>Select a size in the slicer and see the magic of selective colouring unfold.</p>
<div style="width: 1080px;" class="wp-video"><video class="wp-video-shortcode" id="video-2138-9" width="1080" height="513" preload="metadata" controls="controls"><source type="video/mp4" src="https://capstoneanalytics.com.au/wp-content/uploads/2020/03/Selective-colour-Part-1.mp4?_=9" /><a href="https://capstoneanalytics.com.au/wp-content/uploads/2020/03/Selective-colour-Part-1.mp4">https://capstoneanalytics.com.au/wp-content/uploads/2020/03/Selective-colour-Part-1.mp4</a></video></div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://capstoneanalytics.com.au/strategic-colouring-in-power-bi-part-1-comparing-different-metrics-across-a-common-dimension/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		<enclosure url="https://capstoneanalytics.com.au/wp-content/uploads/2020/03/Selective-colour-Part-1.mp4" length="224764" type="video/mp4" />

			</item>
	</channel>
</rss>
