<?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>labels | Capstone Analytics</title>
	<atom:link href="https://capstoneanalytics.com.au/tag/labels/feed/" rel="self" type="application/rss+xml" />
	<link>https://capstoneanalytics.com.au</link>
	<description>Analytics Simplified</description>
	<lastBuildDate>Sat, 25 Sep 2021 03:29:21 +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>User selected labels</title>
		<link>https://capstoneanalytics.com.au/2611-2/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=2611-2</link>
					<comments>https://capstoneanalytics.com.au/2611-2/#respond</comments>
		
		<dc:creator><![CDATA[Abhijith DSouza]]></dc:creator>
		<pubDate>Sat, 25 Sep 2021 03:31:21 +0000</pubDate>
				<category><![CDATA[Power BI]]></category>
		<category><![CDATA[DAX]]></category>
		<category><![CDATA[labels]]></category>
		<guid isPermaLink="false">https://capstoneanalytics.com.au/?p=2611</guid>

					<description><![CDATA[To label or not to label. Labelling of values in a line/bar chart in a dashboard is a contentious issue. Stakeholders coming from the world of static reports in Excel/pdf are used to seeing labels on charts and want the same functionality in Power BI. They do not want to put in the effort of [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>To label or not to label. Labelling of values in a line/bar chart in a dashboard is a contentious issue. Stakeholders coming from the world of static reports in Excel/pdf are used to seeing labels on charts and want the same functionality in Power BI. They do not want to put in the effort of hovering over a data point to get the labels (and more). So for them labelling is a must. However they are others who do not want labels on chart and are happy to explore the interactive functions of Power BI. And then there is the third group who want strategic labels on a chart (First, Last, High, Low). It seems impossible to accomodate everyone for a single chart. Or is it&#8230;</p>
<p>What if you provided a way for the end user to select the type of labels they want (from None to All and everything in between). They can select the lables which suits their requirements and even bookmark their selection for subsequent visits. Wouldnt that be great ? In this blog post we will discuss on how to do this in Power BI.</p>
<p>Lets start by creating a small multiple of sales across countries. It is filtered to one calendar year. I chose the small multiple visual as you can see how to implement the solution for multiple line charts at once. With a bit of formatting it looks like this</p>
<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-2614" src="https://capstoneanalytics.com.au/wp-content/uploads/2021/09/small-multiples.png" alt="" width="1049" height="702" srcset="https://capstoneanalytics.com.au/wp-content/uploads/2021/09/small-multiples.png 1049w, https://capstoneanalytics.com.au/wp-content/uploads/2021/09/small-multiples-980x656.png 980w, https://capstoneanalytics.com.au/wp-content/uploads/2021/09/small-multiples-480x321.png 480w" sizes="(min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1049px, 100vw" /></p>
<p>This chart has no labels. We will also create a new table which will be a disconnected table. It will look like this with the correct ordering.</p>
<p><img decoding="async" class="alignnone size-full wp-image-2615" src="https://capstoneanalytics.com.au/wp-content/uploads/2021/09/labels.png" alt="" width="211" height="136" /></p>
<p>We will then define three measures which will go into the chart above. The first measure is this</p>
<p>Sales Label Measure High =<br />
<span class="Keyword" style="color: #035aca;">VAR</span> <span class="Variable" style="color: #49b0af;">SelLabels</span> =<br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">SELECTEDVALUE</span><span class="Parenthesis" style="color: #808080;"> (</span> Labels[Labels] <span class="Parenthesis" style="color: #808080;">)</span><br />
<span class="Keyword" style="color: #035aca;">VAR</span> <span class="Variable" style="color: #49b0af;">MaxValue</span> =<br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">MAXX</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;Calendar'[ShortMonthName], &#8216;Calendar'[MonthNumberOfYear] <span class="Parenthesis" style="color: #808080;">)</span>,<br />
<span class="indent8">        </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;">SWITCH</span><span class="Parenthesis" style="color: #808080;"> (</span><br />
<span class="indent8">        </span><span class="Variable" style="color: #49b0af;">SelLabels</span>,<br />
<span class="indent8">        </span><span class="StringLiteral" style="color: #d93124;">&#8220;High and Low&#8221;</span>, <span class="Keyword" style="color: #035aca;">IF</span><span class="Parenthesis" style="color: #808080;"> (</span> [Total Sales] = <span class="Variable" style="color: #49b0af;">MaxValue</span>, [Total Sales], <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>,<br />
<span class="indent8">        </span><span class="StringLiteral" style="color: #d93124;">&#8220;First, Last, High, Low&#8221;</span>, <span class="Keyword" style="color: #035aca;">IF</span><span class="Parenthesis" style="color: #808080;"> (</span> [Total Sales] = <span class="Variable" style="color: #49b0af;">MaxValue</span>, [Total Sales], <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>,<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>This will return [Total Sales] when the user selects &#8220;High and Low&#8221; or &#8220;First, Last, High, Loww&#8221; in the selection and when the [Total Sales] is equal to the Maximum value in the range (Jan &#8211; Dec) else it gives blanks.</p>
<p>The next measure is the same as above except it checks the condition of [Total Sales] is equal to the minimum values in the range (Jan &#8211; Dec)</p>
<p>We could have combined these two measures but we want to apply a different colour to the markets for the High and Low data points which will see later. Hence we have defined them separately</p>
<p>Sales Label Measure Low =<br />
<span class="Keyword" style="color: #035aca;">VAR</span> <span class="Variable" style="color: #49b0af;">SelLabels</span> =<br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">SELECTEDVALUE</span><span class="Parenthesis" style="color: #808080;"> (</span> Labels[Labels] <span class="Parenthesis" style="color: #808080;">)</span><br />
<span class="Keyword" style="color: #035aca;">VAR</span> <span class="Variable" style="color: #49b0af;">MinValue</span> =<br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">MINX</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;Calendar'[ShortMonthName], &#8216;Calendar'[MonthNumberOfYear] <span class="Parenthesis" style="color: #808080;">)</span>,<br />
<span class="indent8">        </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;">SWITCH</span><span class="Parenthesis" style="color: #808080;"> (</span><br />
<span class="indent8">        </span><span class="Variable" style="color: #49b0af;">SelLabels</span>,<br />
<span class="indent8">        </span><span class="StringLiteral" style="color: #d93124;">&#8220;High and Low&#8221;</span>, <span class="Keyword" style="color: #035aca;">IF</span><span class="Parenthesis" style="color: #808080;"> (</span> [Total Sales] = <span class="Variable" style="color: #49b0af;">MinValue</span>, [Total Sales], <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>,<br />
<span class="indent8">        </span><span class="StringLiteral" style="color: #d93124;">&#8220;First, Last, High, Low&#8221;</span>, <span class="Keyword" style="color: #035aca;">IF</span><span class="Parenthesis" style="color: #808080;"> (</span> [Total Sales] = <span class="Variable" style="color: #49b0af;">MinValue</span>, [Total Sales], <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>,<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>&nbsp;</p>
<p>We wil define one final measure</p>
<p>Sales Label Measure First Last =<br />
<span class="Keyword" style="color: #035aca;">VAR</span> <span class="Variable" style="color: #49b0af;">SelLabels</span> =<br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">SELECTEDVALUE</span><span class="Parenthesis" style="color: #808080;"> (</span> Labels[Labels] <span class="Parenthesis" style="color: #808080;">)</span><br />
<span class="Keyword" style="color: #035aca;">VAR</span> <span class="Variable" style="color: #49b0af;">SelMonth</span> =<br />
<span class="indent4">    </span><span class="Keyword" style="color: #035aca;">SELECTEDVALUE</span><span class="Parenthesis" style="color: #808080;"> (</span> &#8216;Calendar'[ShortMonthName] <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;">SWITCH</span><span class="Parenthesis" style="color: #808080;"> (</span><br />
<span class="indent8">        </span><span class="Variable" style="color: #49b0af;">SelLabels</span>,<br />
<span class="indent8">        </span><span class="StringLiteral" style="color: #d93124;">&#8220;All&#8221;</span>, [Total Sales],<br />
<span class="indent8">        </span><span class="StringLiteral" style="color: #d93124;">&#8220;First and Last&#8221;</span>,<br />
<span class="indent8">        </span><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;">SelMonth</span> = <span class="StringLiteral" style="color: #d93124;">&#8220;Jan&#8221;</span> || <span class="Variable" style="color: #49b0af;">SelMonth</span> = <span class="StringLiteral" style="color: #d93124;">&#8220;Dec&#8221;</span>, [Total Sales], <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>,<br />
<span class="indent8">        </span><span class="StringLiteral" style="color: #d93124;">&#8220;First, Last, High, Low&#8221;</span>,<br />
<span class="indent8">        </span><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;">SelMonth</span> = <span class="StringLiteral" style="color: #d93124;">&#8220;Jan&#8221;</span> || <span class="Variable" style="color: #49b0af;">SelMonth</span> = <span class="StringLiteral" style="color: #d93124;">&#8220;Dec&#8221;</span>, [Total Sales], <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>,<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>This measure returns [Total Sales] when a user selects &#8220;All&#8221;. It also returns [Total Sales] when a user selects &#8220;First and Last&#8221;, &#8220;First, Last, High, Low&#8221; in the selection and when the selected month is either &#8220;Jan&#8221; or &#8220;Dec&#8221;</p>
<p>Now we place these measures in the small multiple visual so that it looks like this</p>
<p><img decoding="async" class="alignnone size-full wp-image-2616" src="https://capstoneanalytics.com.au/wp-content/uploads/2021/09/small.png" alt="" width="254" height="432" /></p>
<p>Next is where the magic happens, in the formatting pane under Date Colours, Date Labels and Shapes. Here is a short video which goes through all the steps.</p>
<div style="width: 1080px;" class="wp-video"><video class="wp-video-shortcode" id="video-2611-1" width="1080" height="552" preload="metadata" controls="controls"><source type="video/mp4" src="https://capstoneanalytics.com.au/wp-content/uploads/2021/09/20210925_130643.mp4?_=1" /><a href="https://capstoneanalytics.com.au/wp-content/uploads/2021/09/20210925_130643.mp4">https://capstoneanalytics.com.au/wp-content/uploads/2021/09/20210925_130643.mp4</a></video></div>
<p>&nbsp;</p>
<p>Finally we place the Labels colulm from the Labels table in a slicer and start interacting with the report</p>
<div style="width: 1080px;" class="wp-video"><video class="wp-video-shortcode" id="video-2611-2" width="1080" height="552" preload="metadata" controls="controls"><source type="video/mp4" src="https://capstoneanalytics.com.au/wp-content/uploads/2021/09/20210925_132416.mp4?_=2" /><a href="https://capstoneanalytics.com.au/wp-content/uploads/2021/09/20210925_132416.mp4">https://capstoneanalytics.com.au/wp-content/uploads/2021/09/20210925_132416.mp4</a></video></div>
]]></content:encoded>
					
					<wfw:commentRss>https://capstoneanalytics.com.au/2611-2/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		<enclosure url="https://capstoneanalytics.com.au/wp-content/uploads/2021/09/20210925_130643.mp4" length="1885616" type="video/mp4" />
<enclosure url="https://capstoneanalytics.com.au/wp-content/uploads/2021/09/20210925_132416.mp4" length="289615" type="video/mp4" />

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