avatarShashanka Shekhar

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

5244

Abstract

-Year (YoY) Sales KPI value:</p><h1 id="d64e">Variables:</h1><ul><li><code><b>positive_icon</b></code> = "▲"</li><li><code><b>negative_icon</b></code> = "▼"</li></ul><h1 id="fe8e">Logic:</h1><ul><li>If <code><b>[YoY Sales KPI]</b></code> > 0, use <code><b>positive_icon</b></code>.</li><li>Otherwise, use <code><b>negative_icon</b></code>.</li></ul><h1 id="7e0e">Return:</h1><ul><li>The appropriate icon (▲ or ▼) based on the sales KPI.</li></ul><p id="cc74">All these are basic DAX functions which is always good to know, refer the below article to understand them, it’s under 3 min read.</p><div id="3fa3" class="link-block"> <a href="https://medium.com/@shashanka.shekhar02/top-3-most-important-growth-metrics-in-powerbi-ytd-pytd-and-yoy-in-under-3-minutes-f1f75fa30d7c"> <div> <div> <h2>Top 3 Most Important Growth Metrics in PowerBI: YTD, PYTD, and YoY in under 3 Minutes</h2> <div><h3>PowerBI provides insightful data visualization, but navigating growth metrics can be tricky. Fear not, data…</h3></div> <div><p>medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*GiOmysqG4cFC3UQ-xswcJQ.png)"></div> </div> </div> </a> </div><h2 id="3f7c">Creating the Base for the KPI:</h2><ul><li>Add a <b>Card(new) </b>visual<b> </b>and put<b> Sales </b>in it.</li><li>In the <b>Format visual → General →Properties </b>set <b>Height</b> to <b>494 </b>and <b>Width</b> to <b>419.</b></li></ul><figure id="79e7"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*H9BfSPNU4FeF779SckMrHg.gif"><figcaption>In the Format visual → General →Properties set Height to 494 and Width to 419</figcaption></figure><ul><li>In <b>Format visual →Visual →Callout values </b>and<b> turn off Values </b>and<b> Label.</b></li><li>In <b>Cards turn on Shadow.</b></li></ul><figure id="6deb"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*GWWB5ow_akcW7FrWmsAo8w.gif"><figcaption>In Cards turn on Shadow</figcaption></figure><h2 id="397f">Creating the Text Boxes:</h2><ul><li>In the <b>Insert</b> tab select <b>Text box</b>.</li><li>Type <b>SALES BY PRODUCT SEGMENT.</b></li></ul><figure id="018f"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*72v87KJ8XyQaFuxjRTKLbw.gif"><figcaption>In the Insert tab select Text box</figcaption></figure><ul><li>Set <b>Font</b> to <b>DIN </b>and <b>size 16</b> and<b> Bold the font.</b></li><li>In the <b>Format visual → General →Effects turn off Background.</b></li><li>Place it on top of the <b>KPI Base</b> created in the previous step.</li></ul><figure id="a1c8"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*E87xRq2jLgR28E3kErz8ww.gif"><figcaption>Place it on top of the KPI Base created in the previous step</figcaption></figure><ul><li>Copy the <b>SALES YTD</b> text box</li><li>Type <b><i>“Total Sales YTD split by product segment” </i></b>and set <b>size to 12.</b></li><li>Remove the<b> Bold the font</b> setting and place the box below the previous text box.</li></ul><figure id="572b"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*sfzEDe0kZv9H4BpOSRUk8Q.gif"><figcaption>Remove the Bold the font setting and place the box below the previous text box</figcaption></figure><h2 id="7770">Creating the YTD Sales KPI card:</h2><ul><li>Add a <b>Card </b>visual<b> </b>and put<b> YTD Sales KPI </b>to it.</li><li>Set <b>Font</b> to <b>DIN </b>and <b>Bold the font.</b></li><li>In the <b>Format visual → General →Effects turn off Background.</b></li><li>Turn off <b>Category label.</b></li></ul><figure id="d890"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*lm6Ovir4pTuHsi5IDDfuCg.gif"><figcaption></figcaption></figure><h2 id="5e9f">Adding Donut Chart to the KPI:</h2><ul><li>Add a <b>Donut chart </b>and put<b> Segment </b>in<b> Legend </b>and<b> YTD Sales KPI in Values.</b></li><li>In the <b>Format visual → General →Properties </b>set <b>Height</b> to <b>301 </b>and <b>Width</b> to <b>363.</b></li></ul><figure id="d481"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*TH8TUQRhF5vs0kQFOn0TzQ.gif"><figcaption>Add a Donut chart and put Segment in Legend and YTD Sales KPI in Values</figcaption></figure><ul><li>Expand<b> Legend</b> and for <b>Position</b> set <b>Bottom center.</b></li><li>In <b>Legend → Text</b> set font to <b>DIN.</b></li><li>Expand <b>Detail labels</b> set <b>Position</b> to <b>Inside</b> and <b>Label contents</b> to <b>Percent of total.</b></li><li>In the <b>Format visual → General →Effects turn off Background.</b></li><li>In the <b>Format visual → General turn off Title.</b></li></ul><figure id="a333"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*FBF0bPwfTdDWSIbgP7vnIA.gif"><figcaption>Expand Detail labels set Position to Inside and Label contents to Percent of total</figcaption></figure><ul><li>Expand<b> Slices</b> and use the below color scheme:</li></ul><p id="1b5e" type="7">Consumers: #70A702</p><p id="f07f" type="7">Corporate: #0062C5</p><p id="64a2" type="7">Home Office: #C53100</p><figure id="6530

Options

"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*hrNZEYyRR9p39lwP62gZ0Q.gif"><figcaption>Expand Slices and use the above color scheme</figcaption></figure><h2 id="2b43">Creating the YoY Sales Percentage trend indicator:</h2><ul><li>Add a <b>Card(new) </b>visual<b> </b>and put<b> Sales Indicator PP KPI </b>in it.</li><li>Turn off <b>Category label.</b></li><li>Set <b>size</b> to <b>12</b> and <b>Bold the font.</b></li><li>In the <b>Format visual → General →Effects turn off Background.</b></li></ul><figure id="fd22"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*csngdBfBvsZHIn47NbLTqQ.gif"><figcaption>Set size to 12 and Bold the font</figcaption></figure><ul><li>In <b>Format visual → Callout values </b>in the<b> Color section </b>press<b> <i>fx</i>.</b></li><li>Keep <b>Format Style → Rules</b> and in field select <b>Sales Colour KPI.</b></li><li>Type <b>Green</b> select<b> #01C521 </b>for color<b> </b>and for <b>Red </b>select <b>#CD2900, </b>press OK.</li></ul><figure id="5776"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*GFlKjLgMEPHX6e1wuWfDaw.gif"><figcaption>Keep Format Style → Rules and in field select Sales Colour KPI</figcaption></figure><ul><li>Copy the <b>Sales Indicator PP KPI </b>card.</li><li>Put <b>YoY</b> <b>Sales KPI </b>in it.</li><li>Place it next to the sales indicator.</li></ul><figure id="8843"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*XvrGwJJlJ0DGpp-5suL_sg.gif"><figcaption></figcaption></figure><p id="3bd2">Check out this article to learn more about KPIs with “<b><i>Conditional Formatting as we did above for YoY Sales”</i></b><i>.</i></p><div id="dbb4" class="link-block"> <a href="https://readmedium.com/4-easy-steps-to-create-a-kpi-with-an-indicator-in-power-bi-fd6c1d615c6c"> <div> <div> <h2>4 easy steps to create a KPI with an indicator in Power BI</h2> <div><h3>Power BI is a platform that 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/1*CjaPHdqifRQCGgeRhjvhSw.png)"></div> </div> </div> </a> </div><p id="a0eb">Finally we have our KPI.</p><figure id="d201"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*zc-6itQmJ74KsQThabcc1A.png"><figcaption>The Final KPI</figcaption></figure><figure id="3b51"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*g8Ybc1U_1lMqlsKC-J1o3g.jpeg"><figcaption></figcaption></figure><p id="687b" type="7">Download the data for the KPI from this link.</p><p id="1aea" type="7">Download the PBIX file from this link.</p><div id="2d05" class="link-block"> <a href="https://readmedium.com/sorting-multiple-columns-using-power-query-in-power-bi-d9ab4181af28"> <div> <div> <h2>Sorting Multiple Columns using Power Query in Power BI</h2> <div><h3>Sorting Multiple Columns Using Power Query in Power BI</h3></div> <div><p>medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*WJgDRPC3KZjLhDs2l_VI9A.jpeg)"></div> </div> </div> </a> </div><p id="1561">Thank you for your attention!</p><p id="4290"><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="d29b" 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*Q00X5HWj4ZFEadEj)"></div> </div> </div> </a> </div><p id="0b2b" type="7">Don’t forget to subscribe to</p><p id="799d" type="7">👉 Power BI Publication</p><p id="6811" type="7">👉 Power BI Newsletter</p><p id="88d4" type="7">and join our Power BI community:</p><div id="f2ab" class="link-block"> <a href="https://linktr.ee/powerbi.masterclass?source=post_page-----d9ab4181af28--------------------------------"> <div> <div> <h2>Microsoft Power BI Masterclass | 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*BtWEdseELxrrjpyu)"></div> </div> </div> </a> </div></article></body>

Creating a Sales by Product Segment KPI with a Donut chart in Power BI

Creating a Sales by Product Segment KPI with a Donut Chart in Power BI is a powerful way to visualize and track the performance of different product segments within your business. This KPI can help you quickly identify which segments are performing well and which need attention. In this article, we’ll guide you through the process of setting up this KPI in Power BI, using a donut chart to make your data pop.

Why a Donut Chart for KPIs?

  • Visual Appeal: Donut charts offer a clean and simple way to display data, making it easy to understand at a glance.
  • Comparison: They allow for easy comparison between different segments, helping you spot trends and outliers quickly.
  • Customization: Power BI’s flexibility lets you customize your donut chart to match your specific needs and preferences.

What You’ll Learn:

  • Data Preparation: How to organize and format your data for optimal use in Power BI.
  • Creating the KPI: Step-by-step instructions on setting up a Sales by Product Segment KPI.
  • Designing the Donut Chart: Tips and tricks for creating a visually appealing and informative donut chart.
  • Analyzing Results: How to interpret the KPI and use the insights to drive business decisions.

By the end of this guide, you’ll have a stunning donut chart in Power BI that effectively communicates the performance of your product segments.

This is how our end result is going to look like:

The Final KPI

Building the KPI

We will go through these steps:

Happy learning!

Creating the DAX Functions:

YTD Sales KPI = TOTALYTD(SUM(Table1[Sales]), Table1[Order Date])

The DAX formula calculates the Year-to-Date (YTD) profit for the Table1 dataset. It calculates the cumulative profit from the beginning of the year to the current date based on the Table1[Order Date] column.

PYTD Sales KPI = CALCULATE(SUM(Table1[Sales]), SAMEPERIODLASTYEAR(Table1[Order Date]))

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 KPI = ([YTD Sales KPI] — [PYTD Sales KPI])/[PYTD Sales KPI]

DAX for YoY Sales KPI

Sales Colour KPI = IF([YoY Sales KPI]>0,”Green”,”Red”)

DAX for Sales Colour KPI

It assigns Sales Colour KPI Green or Red depending on the value of YoY Sales KPI greater or less than zero respectively.

Sales Indicator PP KPI = var positive_icon = “▲”

var negative_icon = “▼”

var result = IF([YoY Sales KPI]>0, positive_icon, negative_icon)

return result

Sales Indicator PP KPI

This DAX formula creates a KPI indicator based on the Year-over-Year (YoY) Sales KPI value:

Variables:

  • positive_icon = "▲"
  • negative_icon = "▼"

Logic:

  • If [YoY Sales KPI] > 0, use positive_icon.
  • Otherwise, use negative_icon.

Return:

  • The appropriate icon (▲ or ▼) based on the sales KPI.

All these are basic DAX functions which is always good to know, refer the below article to understand them, it’s under 3 min read.

Creating the Base for the KPI:

  • Add a Card(new) visual and put Sales in it.
  • In the Format visual → General →Properties set Height to 494 and Width to 419.
In the Format visual → General →Properties set Height to 494 and Width to 419
  • In Format visual →Visual →Callout values and turn off Values and Label.
  • In Cards turn on Shadow.
In Cards turn on Shadow

Creating the Text Boxes:

  • In the Insert tab select Text box.
  • Type SALES BY PRODUCT SEGMENT.
In the Insert tab select Text box
  • Set Font to DIN and size 16 and Bold the font.
  • In the Format visual → General →Effects turn off Background.
  • Place it on top of the KPI Base created in the previous step.
Place it on top of the KPI Base created in the previous step
  • Copy the SALES YTD text box
  • Type “Total Sales YTD split by product segment” and set size to 12.
  • Remove the Bold the font setting and place the box below the previous text box.
Remove the Bold the font setting and place the box below the previous text box

Creating the YTD Sales KPI card:

  • Add a Card visual and put YTD Sales KPI to it.
  • Set Font to DIN and Bold the font.
  • In the Format visual → General →Effects turn off Background.
  • Turn off Category label.

Adding Donut Chart to the KPI:

  • Add a Donut chart and put Segment in Legend and YTD Sales KPI in Values.
  • In the Format visual → General →Properties set Height to 301 and Width to 363.
Add a Donut chart and put Segment in Legend and YTD Sales KPI in Values
  • Expand Legend and for Position set Bottom center.
  • In Legend → Text set font to DIN.
  • Expand Detail labels set Position to Inside and Label contents to Percent of total.
  • In the Format visual → General →Effects turn off Background.
  • In the Format visual → General turn off Title.
Expand Detail labels set Position to Inside and Label contents to Percent of total
  • Expand Slices and use the below color scheme:

Consumers: #70A702

Corporate: #0062C5

Home Office: #C53100

Expand Slices and use the above color scheme

Creating the YoY Sales Percentage trend indicator:

  • Add a Card(new) visual and put Sales Indicator PP KPI in it.
  • Turn off Category label.
  • Set size to 12 and Bold the font.
  • In the Format visual → General →Effects turn off Background.
Set size to 12 and Bold the font
  • In Format visual → Callout values in the Color section press fx.
  • Keep Format Style → Rules and in field select Sales Colour KPI.
  • Type Green select #01C521 for color and for Red select #CD2900, press OK.
Keep Format Style → Rules and in field select Sales Colour KPI
  • Copy the Sales Indicator PP KPI card.
  • Put YoY Sales KPI in it.
  • Place it next to the sales indicator.

Check out this article to learn more about KPIs with “Conditional Formatting as we did above for YoY Sales”.

Finally we have our KPI.

The Final KPI

Download the data for the KPI from this link.

Download the PBIX file from this link.

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