{"id":67,"date":"2017-05-23T13:22:19","date_gmt":"2017-05-23T11:22:19","guid":{"rendered":"http:\/\/cwiok.pl\/testowe\/?p=67"},"modified":"2018-05-23T17:09:36","modified_gmt":"2018-05-23T15:09:36","slug":"powerbi-tutorial-change-units-with-slicers","status":"publish","type":"post","link":"https:\/\/cwiok.pl\/index.php\/en\/2017\/05\/23\/powerbi-tutorial-change-units-with-slicers\/","title":{"rendered":"Change units with slicers"},"content":{"rendered":"<p>Today I will show you a simple solution enabling the change of units\/currencies or other perspectives using slicers. This will make a report more responsive and cleaner. From my experience, customers will be able to find the insights they are after much quicker. The end effect will look like this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-69 aligncenter\" src=\"http:\/\/cwiok.pl\/wp-content\/uploads\/2017\/05\/Showcase.gif\" alt=\"\" width=\"2540\" height=\"1104\" \/><\/p>\n<p><!--more--><\/p>\n<p>After setting up a conversion table your options are endless. You can insert different currencies, units, types of measurements. The number of those is not restrained in any way neither.<\/p>\n<p>In my dashboards I use it very often to show different currencies in the same field. Something like this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-81 aligncenter\" src=\"http:\/\/cwiok.pl\/wp-content\/uploads\/2017\/05\/Showcase_2.gif\" alt=\"\" width=\"356\" height=\"260\" \/><\/p>\n<p>In this tutorial I am using a sample sales data I have downloaded from <a href=\"http:\/\/www.contextures.com\/xlSampleData01.html\">here<\/a>.<\/p>\n<p>To get the solution running, please follow these steps:<\/p>\n<h4>First, create a support table with names of the units e.g. USD and EUR, value and volume etc.<\/h4>\n<p><strong>To do that click Enter Data:<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-73 aligncenter\" src=\"http:\/\/cwiok.pl\/wp-content\/uploads\/2017\/05\/Enter-data.png\" alt=\"\" width=\"438\" height=\"282\" srcset=\"https:\/\/cwiok.pl\/wp-content\/uploads\/2017\/05\/Enter-data.png 438w, https:\/\/cwiok.pl\/wp-content\/uploads\/2017\/05\/Enter-data-300x193.png 300w\" sizes=\"auto, (max-width: 438px) 100vw, 438px\" \/><\/p>\n<p><strong>Enter units\/currencies that are important to you.<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-72 aligncenter\" src=\"http:\/\/cwiok.pl\/wp-content\/uploads\/2017\/05\/Create-Table.png\" alt=\"\" width=\"335\" height=\"246\" srcset=\"https:\/\/cwiok.pl\/wp-content\/uploads\/2017\/05\/Create-Table.png 335w, https:\/\/cwiok.pl\/wp-content\/uploads\/2017\/05\/Create-Table-300x220.png 300w\" sizes=\"auto, (max-width: 335px) 100vw, 335px\" \/><\/p>\n<p><strong>After creating the table, select new measure. This is the most important step, as the calculation will happen in the DAX query.<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-74 aligncenter\" src=\"http:\/\/cwiok.pl\/wp-content\/uploads\/2017\/05\/new-measure.png\" alt=\"\" width=\"439\" height=\"266\" srcset=\"https:\/\/cwiok.pl\/wp-content\/uploads\/2017\/05\/new-measure.png 439w, https:\/\/cwiok.pl\/wp-content\/uploads\/2017\/05\/new-measure-300x182.png 300w\" sizes=\"auto, (max-width: 439px) 100vw, 439px\" \/><\/p>\n<p><strong>If you use the data for example, you can type something similar:<\/strong><\/p>\n<pre>Measure = IF(VALUES('Conversion 1'[Currencies]) = \"USD\", FORMAT(SUM('Sample data (2)'[UnitCost]),\"$#,##0.00;($#,##0.00)\") ,FORMAT(SUM('Sample data (2)'[UnitCost])*0.8,\"#,##0.00\u20ac;(#,##0.00\u20ac)\"))<\/pre>\n<p>This part checks, which currency is filtered. Basing on this logical test we will proceed with the calculation:<\/p>\n<pre>VALUES('Conversion 1'[Currencies]) = \"USD\"<\/pre>\n<p>If value is indeed USD, we choose to return:<\/p>\n<pre> FORMAT(SUM('Sample data (2)'[UnitCost]),\"$#,##0.00;($#,##0.00)\")<\/pre>\n<p>Otherwise, we choose to return:<\/p>\n<pre> FORMAT(SUM('Sample data (2)'[UnitCost])*0.8,\"#,##0.00\u20ac;(#,##0.00\u20ac)\"))<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>After setting up a measure, create a slicer using the newly created conversion table.<\/strong><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-75 aligncenter\" src=\"http:\/\/cwiok.pl\/wp-content\/uploads\/2017\/05\/slicer.png\" alt=\"\" width=\"338\" height=\"207\" srcset=\"https:\/\/cwiok.pl\/wp-content\/uploads\/2017\/05\/slicer.png 338w, https:\/\/cwiok.pl\/wp-content\/uploads\/2017\/05\/slicer-300x184.png 300w\" sizes=\"auto, (max-width: 338px) 100vw, 338px\" \/><br \/>\nTo view your data, create a card with the new measure.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\" wp-image-80 aligncenter\" src=\"http:\/\/cwiok.pl\/wp-content\/uploads\/2017\/05\/card.png\" alt=\"\" width=\"310\" height=\"209\" srcset=\"https:\/\/cwiok.pl\/wp-content\/uploads\/2017\/05\/card.png 452w, https:\/\/cwiok.pl\/wp-content\/uploads\/2017\/05\/card-300x202.png 300w\" sizes=\"auto, (max-width: 310px) 100vw, 310px\" \/><b><\/b><i><\/i><u><\/u><\/p>\n<p>As you click the filters the value changes!<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-81 aligncenter\" src=\"http:\/\/cwiok.pl\/wp-content\/uploads\/2017\/05\/Showcase_2.gif\" alt=\"\" width=\"512\" height=\"374\" \/><\/p>\n<p>To create the same effect on the charts, remember not to use any string formatting as it will interfere with PowerBi engine.<\/p>\n<p>Thanks!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today I will show you a simple solution enabling the change of units\/currencies or other perspectives using slicers. This will make a report more responsive and cleaner. From my experience, customers will be able to find the insights they are after much quicker. The end effect will look like this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-69 aligncenter\" src=\"http:\/\/cwiok.pl\/wp-content\/uploads\/2017\/05\/Showcase.gif\" alt=\"\" width=\"2540\" height=\"1104\" \/><\/p>\n<div class=\"tech_read_more\"><a href=\"https:\/\/cwiok.pl\/index.php\/en\/2017\/05\/23\/powerbi-tutorial-change-units-with-slicers\/\">Read More<\/a><\/div>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-67","post","type-post","status-publish","format-standard","hentry","category-powerbi"],"_links":{"self":[{"href":"https:\/\/cwiok.pl\/index.php\/wp-json\/wp\/v2\/posts\/67","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cwiok.pl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cwiok.pl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cwiok.pl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cwiok.pl\/index.php\/wp-json\/wp\/v2\/comments?post=67"}],"version-history":[{"count":0,"href":"https:\/\/cwiok.pl\/index.php\/wp-json\/wp\/v2\/posts\/67\/revisions"}],"wp:attachment":[{"href":"https:\/\/cwiok.pl\/index.php\/wp-json\/wp\/v2\/media?parent=67"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cwiok.pl\/index.php\/wp-json\/wp\/v2\/categories?post=67"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cwiok.pl\/index.php\/wp-json\/wp\/v2\/tags?post=67"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}