avatarShashanka Shekhar

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

3268

Abstract

allows you to connect to various data sources, transform and model your data, and create…</h3></div> <div><p>medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*hykplWlepVDDpnpo)"></div> </div> </div> </a> </div><blockquote id="d300"><p><b>PYTD Sales = CALCULATE(SUM(ecommerce_data[sales_per_order]), SAMEPERIODLASTYEAR(Calender[Date]))</b></p></blockquote><figure id="d51c"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*1r2HU-RxeEn0WX5qcI_F0Q.png"><figcaption>DAX for PYTD Sales</figcaption></figure><p id="ac0e"><b>CALCULATE</b></p><p id="a412">The <code><b>CALCULATE</b></code> function evaluates an expression in a modified filter context. Essentially, it allows you to change the context in which data is evaluated.</p><p id="4c90"><b>Syntax:</b></p><div id="353d"><pre>CALCULATE(<span class="hljs-tag"><<span class="hljs-name">expression</span>></span>, <span class="hljs-tag"><<span class="hljs-name">filter1</span>></span>, <span class="hljs-tag"><<span class="hljs-name">filter2</span>></span>, ...)</pre></div><p id="c444"><b>SAMEPERIODLASTYEAR</b></p><p id="7c30">The <code><b>SAMEPERIODLASTYEAR</b></code> function is a time intelligence function that returns a table with the same period in the previous year. It’s useful for year-over-year comparisons.</p><p id="f8fd"><b>Syntax:</b></p><div id="70cd"><pre><span class="hljs-built_in">SAMEPERIODLASTYEAR</span>(<dates>)</pre></div><blockquote id="d16d"><p><b>YoY Sales = ([YTD Sales] — [PYTD Sales])/[PYTD Sales]</b></p></blockquote><figure id="70db"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*8YBaPLhp1_EHfqyeuXp9Og.png"><figcaption>DAX for YoY Sales</figcaption></figure><h2 id="3e2a">2. Creating a Map:</h2><ul><li>Add a <b>Map</b> from <b>Visualizations</b>.</li><li>Add <b>state</b> in <b>Location</b> section.</li><li>Add <b>YTD Sales </b>in <b>Bubble size </b>section.</li><li>In <b>Format visual → Visual → Map settings </b>select<b> Dark.</b></li></ul><figure id="9004"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*w0PXzz9nkgjgeAUbZqiwXA.gif"><figcaption>Creating a Map</figcaption></figure><h2 id="c1f3">3. Creating the Tooltip:</h2><ul><li>In a Blank page go to <b>Canvas settings.</b></li><li>In <b>Type</b> select <b>Tootltip.</b></li><li>Add a Multi-row card and put YTD Sales, YoY Sales and state to it.</li><li>With card selected in <b>Format visual → General </b>expand<b> Properties</b> and in<b> Height</b> use<b> 86 </b>and in<b> Width </b>use<b> 300.</b></li><li>In <b>Format visual → Visual</b> expand<b> Category labels </b>and <b>Bold the Font.</b></li></ul><figure id="7a67"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*NxG55YskVRvJBv-yTagjOw.gif"><figcaption>Creating the Tooltip</figcaption></figure><ul><li>Expand <b>Cards</b> and <b>turn off Accent bar.</b></li><li>Now deselect the card and in <b>Canvas settings</b> select <b>Custom</b> and use for <b>Height</b> <b>80 </b>and for<b> Width </b>use<b> 240.</b></li></ul><h2 id="aa96">4. Setting up the Tooltip:</h2><ul><li>Select the card and in <b

Options

Format visual → General → Effects </b>set<b> Background Color </b>to<b> #A0D1FF.</b></li><li>Now deselect the card and in <b>Page information</b> type <b>CustomizedTooltip</b> and <b>turn on Allow use as tooltip.</b></li></ul><figure id="2d2e"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*3C452jdbZk0xI7vjxkK6xg.gif"><figcaption>Setting up the Tooltip</figcaption></figure><h2 id="d288">5. Adding the Tooltip to the Map:</h2><ul><li>Select the <b>Map.</b></li><li>In <b>Format visual → General </b>expand<b> Tooltip,</b> in<b> Type </b>keep<b> Report page </b>and<b> </b>in<b> Page </b>select<b> CustomizedTooltip.</b></li><li>Hover over the Bubbles to see the custom tooltip.</li></ul><figure id="3d95"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*nomqbyyWSS3e7I2MqZqkjA.gif"><figcaption>Adding the Tooltip to the Map</figcaption></figure><div id="5395" class="link-block"> <a href="https://readmedium.com/making-a-functional-and-indicative-kpi-in-power-bi-e33eb7a3ac57"> <div> <div> <h2>Making a Functional and Indicative KPI in Power BI</h2> <div><h3>Creating effective Key Performance Indicators (KPIs) in Power BI is crucial for any business looking to leverage…</h3></div> <div><p>medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*XUwBVq2XrdWHsWYHuNIeqg.jpeg)"></div> </div> </div> </a> </div><p id="bbd4">Thank you for your attention!</p><p id="6001"><a href="https://medium.com/@shashanka.shekhar02">Follow</a> me or <a href="https://medium.com/@shashanka.shekhar02/subscribe">subscribe </a>to get all my Power BI articles!</p><div id="cbd0" class="link-block"> <a href="https://medium.com/@shashanka.shekhar02"> <div> <div> <h2>Shashanka Shekhar - Medium</h2> <div><h3>Read writing from Shashanka Shekhar on Medium. Contributor for Microsoft Power BI. I like Data Analysis and Data…</h3></div> <div><p>medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*yYi3BMpYUIib-j_U)"></div> </div> </div> </a> </div><p id="6389" type="7">Don’t forget to subscribe to</p><p id="2689" type="7">👉 Power BI Publication</p><p id="d808" type="7">👉 Power BI Newsletter</p><p id="aa59" type="7">and join our Power BI community:</p><div id="4f69" class="link-block"> <a href="https://linktr.ee/powerbi.masterclass"> <div> <div> <h2>Microsoft Power BI Masterclass | Twitter, Instagram | Linktree</h2> <div><h3>Let’s share our Microsoft Power BI experience. Learn together. Grow together.</h3></div> <div><p>linktr.ee</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*9Eg9CiCogmIHDYAn)"></div> </div> </div> </a> </div></article></body>

Building a Customized Tooltip in Power BI

Creating customized tooltips in Power BI can significantly enhance the user experience by providing additional context and insights directly within your visualizations. This article guides you through the process of building these tooltips, ensuring your reports are both informative and visually appealing.

Tooltips are small pop-up boxes that appear when you hover over a data point in a visual. They provide additional information without cluttering the main report. By customizing these tooltips, you can tailor the information to better suit the needs of your audience.

Key Highlights:

Understanding Tooltips:

  • Tooltips provide additional context and details.
  • They help keep the main report clean and focused.

Benefits of Custom Tooltips:

  • Enhance data storytelling by displaying relevant details.
  • Improve user interaction and engagement with the report.
  • Offer a cleaner and more organized way to present supplementary data.

Customization Options:

  • Use different visual types (charts, tables, etc.) within the tooltip.
  • Apply formatting options to match the tooltip with your report’s theme.
  • Utilize dynamic content to make tooltips context-sensitive.

By following these tips and exploring the customization options, you can create powerful, customized tooltips that add depth and clarity to your Power BI reports.

In effect you will end up with the below tooltip:

Implementation in Power BI:

Here are all the steps we will be following in the step-by-step guide to help you set it up:

  1. Calculating DAX for YTD Sales and YoY Sales
  2. Creating a Map
  3. Creating the Tooltip
  4. Setting up the Tooltip
  5. Adding the Tooltip to the Map

Happy learning!

1. Calculating DAX for YTD Sales and YoY Sales:

We will begin by creating a few DAX functions:

YTD Sales = TOTALYTD(SUM(ecommerce_data[sales_per_order]), Calender[Date])

DAX for YTD Sales

This DAX requires a calendar table refer below to create one it’s easy.

PYTD Sales = CALCULATE(SUM(ecommerce_data[sales_per_order]), SAMEPERIODLASTYEAR(Calender[Date]))

DAX for PYTD Sales

CALCULATE

The CALCULATE function evaluates an expression in a modified filter context. Essentially, it allows you to change the context in which data is evaluated.

Syntax:

CALCULATE(<expression>, <filter1>, <filter2>, ...)

SAMEPERIODLASTYEAR

The SAMEPERIODLASTYEAR function is a time intelligence function that returns a table with the same period in the previous year. It’s useful for year-over-year comparisons.

Syntax:

SAMEPERIODLASTYEAR(<dates>)

YoY Sales = ([YTD Sales] — [PYTD Sales])/[PYTD Sales]

DAX for YoY Sales

2. Creating a Map:

  • Add a Map from Visualizations.
  • Add state in Location section.
  • Add YTD Sales in Bubble size section.
  • In Format visual → Visual → Map settings select Dark.
Creating a Map

3. Creating the Tooltip:

  • In a Blank page go to Canvas settings.
  • In Type select Tootltip.
  • Add a Multi-row card and put YTD Sales, YoY Sales and state to it.
  • With card selected in Format visual → General expand Properties and in Height use 86 and in Width use 300.
  • In Format visual → Visual expand Category labels and Bold the Font.
Creating the Tooltip
  • Expand Cards and turn off Accent bar.
  • Now deselect the card and in Canvas settings select Custom and use for Height 80 and for Width use 240.

4. Setting up the Tooltip:

  • Select the card and in Format visual → General → Effects set Background Color to #A0D1FF.
  • Now deselect the card and in Page information type CustomizedTooltip and turn on Allow use as tooltip.
Setting up the Tooltip

5. Adding the Tooltip to the Map:

  • Select the Map.
  • In Format visual → General expand Tooltip, in Type keep Report page and in Page select CustomizedTooltip.
  • Hover over the Bubbles to see the custom tooltip.
Adding the Tooltip to the Map

Thank you for your attention!

Follow me or subscribe to get all my Power BI articles!

Don’t forget to subscribe to

👉 Power BI Publication

👉 Power BI Newsletter

and join our Power BI community:

Power Bi
Data Visualization
Business
Data Science
Finance
Recommended from ReadMedium