{"id":33703,"date":"2021-01-22T14:48:46","date_gmt":"2021-01-22T14:48:46","guid":{"rendered":"https:\/\/www.testpreptraining.com\/tutorial\/?page_id=33703"},"modified":"2021-01-22T14:48:48","modified_gmt":"2021-01-22T14:48:48","slug":"create-measures-with-the-data-analysis-expressions-dax","status":"publish","type":"page","link":"https:\/\/www.testpreptraining.ai\/tutorial\/create-measures-with-the-data-analysis-expressions-dax\/","title":{"rendered":"Create Measures with the Data Analysis Expressions (DAX)"},"content":{"rendered":"\n<p>In general, Power BI Desktop calculates and returns values automatically, based on the types of fields and aggregations being selected. But, there are cases when you may wish to create your own measures for performing more complex, unique calculations. Also, with Power BI Desktop, you can create your own measures with the Data Analysis Expressions (DAX) formula language.<\/p>\n\n\n\n<p>Now, DAX formulas use many of the same functions, operators, and syntax as defined in Excel formulas. However, DAX functions are built to operate with relational data and perform more dynamic calculations as you interact with the reports. Note, there are more than 200 DAX functions that perform simple aggregations like sum and average to more complex statistical and filtering functions. <\/p>\n\n\n\n<p>The measures that are created by you are called a\u00a0<em>model<\/em>\u00a0measure, which is added to the\u00a0<strong>Fields<\/strong>\u00a0list for the table you select. The primary benefits of model measures are  &#8211; <\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Firstly, you can name them whatever you want, thereby making them more identifiable<\/li><li>Secondly, you can use them as arguments in other DAX expressions<\/li><li>Lastly, you can make them perform complex calculations quickly.<\/li><\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Methods to create a quick measure <\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li>First &#8211; From a table in the\u00a0<strong>Fields<\/strong>\u00a0pane, right-click or select\u00a0<strong>More options<\/strong>\u00a0(<strong>&#8230;<\/strong>), and then select\u00a0<strong>New quick measure<\/strong>\u00a0from the list.<\/li><li>Second &#8211; Under\u00a0<strong>Calculations<\/strong>\u00a0in the\u00a0<strong>Home<\/strong>\u00a0tab of the Power BI Desktop ribbon, select\u00a0<strong>New Quick Measure<\/strong>.<\/li><\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Steps to create a measure<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li>Firstly, in the\u00a0<strong>Fields<\/strong>\u00a0pane, right-click the\u00a0<strong>Sales<\/strong>\u00a0table, or hover over the table and select\u00a0<strong>More options<\/strong>\u00a0(<strong>&#8230;<\/strong>).<\/li><li>In the second step, from the menu that appears, select\u00a0<strong>New measure<\/strong>.This action saves your new measure in the\u00a0<strong>Sales<\/strong>\u00a0table, where it&#8217;s easy to find.<\/li><li>Then, the formula bar appears along the top of the report canvas, where you can rename your measure and enter a DAX formula.<\/li><li>However, by default, each new measure is named\u00a0<em>Measure<\/em>. But if you don\u2019t rename it, additional new measures are named\u00a0<em>Measure 2<\/em>,\u00a0<em>Measure 3<\/em>, and so on. since we want this measure to be more identifiable, highlight\u00a0<em>Measure<\/em>\u00a0in the formula bar, and then change it to\u00a0<em>Net Sales<\/em>.<\/li><li>Now, start by entering your formula. After the equals sign, start to type\u00a0<em>Sum<\/em>. As you type, a drop-down suggestion list appears, showing all the DAX functions, beginning with the letters you type. Scroll down, if necessary, to select\u00a0<strong>SUM<\/strong>\u00a0from the list, and then press\u00a0<strong>Enter<\/strong>.<\/li><li>Expressions always appear between opening and closing parentheses. For this example, your expression contains a single argument to pass to the SUM function: the\u00a0<strong>SalesAmount<\/strong>\u00a0column. Begin typing\u00a0<em>SalesAmount<\/em>\u00a0until\u00a0<strong>Sales(SalesAmount)<\/strong>\u00a0is the only value left in the list.<\/li><li>Then, select\u00a0<strong>Sales[SalesAmount]<\/strong>\u00a0from the list, and then enter a closing parenthesis.<\/li><li>Press\u00a0<strong>Enter<\/strong>\u00a0or select\u00a0<strong>Commit<\/strong>\u00a0(checkmark icon) in the formula bar to complete and validate the formula.<\/li><li>Also, if you run out of room for entering a formula or want it on separate lines, select the down arrow on the right side of the formula bar to provide more space.<\/li><li>Lastly, separate parts of your formula by pressing\u00a0<strong>Alt<\/strong>\u00a0+\u00a0<strong>Enter<\/strong>\u00a0for separate lines, or pressing\u00a0<strong>Tab<\/strong>\u00a0to add tab spacing.<\/li><\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"use-your-measure-in-the-report\"><strong>Steps to use your measure in the report<\/strong><\/h4>\n\n\n\n<p>For adding your new\u00a0<strong>Net Sales<\/strong>\u00a0measure to the report canvas, and calculate net sales for whatever other fields you add to the report.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized is-style-default\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/docs.microsoft.com\/en-us\/power-bi\/transform-model\/media\/desktop-tutorial-create-measures\/meastut_netsales_byrcn.png\" alt=\"Net Sales by Country\" width=\"708\" height=\"327\"\/><figcaption>Source: Microsoft<\/figcaption><\/figure>\n\n\n\n<p>For observing net sales by country use the following steps &#8211;<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Firstly, select the\u00a0<strong>Net Sales<\/strong>\u00a0measure from the\u00a0<strong>Sales<\/strong>\u00a0table, or drag it onto the report canvas.<\/li><li>Then, select the\u00a0<strong>RegionCountryName<\/strong>\u00a0field from the\u00a0<strong>Geography<\/strong>\u00a0table, or drag it onto the\u00a0<strong>Net Sales<\/strong>\u00a0chart.<\/li><li>Lastly, to see the difference between net sales and total sales by country, select the\u00a0<strong>SalesAmount<\/strong>\u00a0field or drag it onto the chart.<\/li><\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"use-your-measure-with-a-slicer\"><strong>Steps to use your measure with a slicer<\/strong><\/h4>\n\n\n\n<p>Let us discuss to add a slicer to further filter net sales and sales amounts by calendar year &#8211;<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Firstly, select a blank area next to the chart. In the\u00a0<strong>Visualizations<\/strong>\u00a0pane, select the\u00a0<strong>Table<\/strong>\u00a0visualization. This action creates a blank table visualization on the report canvas.<\/li><li>Secondly, drag the\u00a0<strong>Year<\/strong>\u00a0field from the\u00a0<strong>Calendar<\/strong>\u00a0table onto the new blank table visualization. Since <strong>Year<\/strong>\u00a0is a numeric field, Power BI Desktop sums up its values. <\/li><li>Then, in the\u00a0<strong>Values<\/strong>\u00a0box in the\u00a0<strong>Visualizations<\/strong>\u00a0pane, select the down arrow next to\u00a0<strong>Year<\/strong>, and then select\u00a0<strong>Don&#8217;t summarize<\/strong>\u00a0from the list. The table now lists individual years.<\/li><li>Now, select the\u00a0<strong>Slicer<\/strong>\u00a0icon in the\u00a0<strong>Visualizations<\/strong>\u00a0pane to convert the table to a slicer. If the visualization displays a slider instead of a list, select\u00a0<strong>List<\/strong>\u00a0from the down arrow in the slider.<\/li><li>Lastly, select any value in the\u00a0<strong>Year<\/strong>\u00a0slicer to filter the\u00a0<strong>Net Sales and Sales Amount by RegionCountryName<\/strong>\u00a0chart accordingly. The\u00a0<strong>Net Sales<\/strong>\u00a0and\u00a0<strong>SalesAmount<\/strong>\u00a0measures recalculate and display results in the context of the selected\u00a0<strong>Year<\/strong>\u00a0field.<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image is-style-default\"><figure class=\"aligncenter\"><a href=\"https:\/\/www.testpreptraining.ai\/analyzing-data-with-microsoft-power-bi-da-100-free-test\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2021\/01\/Microsoft-Exam-DA-100-Free-Practice-Test.png\" alt=\"Microsoft Exam DA-100 Free Practice Test\"\/><\/a><\/figure><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In general, Power BI Desktop calculates and returns values automatically, based on the types of fields and aggregations being selected. But, there are cases when you may wish to create your own measures for performing more complex, unique calculations. Also, with Power BI Desktop, you can create your own measures with the Data Analysis Expressions&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"categories":[174],"tags":[1830,3955,3954],"class_list":["post-33703","page","type-page","status-publish","hentry","category-microsoft-azure","tag-da-100-study-guide","tag-microsoft-exam-da-100-exam-questions","tag-microsoft-exam-da-100-free-practice-test"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Create Measures with the Data Analysis Expressions (DAX) | Testprep<\/title>\n<meta name=\"description\" content=\"Learn to create measures with the Data Analysis Expressions (DAX) with online tutorial. Start preparing for Microsoft Exam DA-100 Now!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.testpreptraining.ai\/tutorial\/create-measures-with-the-data-analysis-expressions-dax\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Create Measures with the Data Analysis Expressions (DAX) | Testprep\" \/>\n<meta property=\"og:description\" content=\"Learn to create measures with the Data Analysis Expressions (DAX) with online tutorial. Start preparing for Microsoft Exam DA-100 Now!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.testpreptraining.ai\/tutorial\/create-measures-with-the-data-analysis-expressions-dax\/\" \/>\n<meta property=\"og:site_name\" content=\"Testprep Training Tutorials\" \/>\n<meta property=\"article:modified_time\" content=\"2021-01-22T14:48:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/docs.microsoft.com\/en-us\/power-bi\/transform-model\/media\/desktop-tutorial-create-measures\/meastut_netsales_byrcn.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/create-measures-with-the-data-analysis-expressions-dax\/\",\"url\":\"https:\/\/www.testpreptraining.ai\/tutorial\/create-measures-with-the-data-analysis-expressions-dax\/\",\"name\":\"Create Measures with the Data Analysis Expressions (DAX) | Testprep\",\"isPartOf\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#website\"},\"datePublished\":\"2021-01-22T14:48:46+00:00\",\"dateModified\":\"2021-01-22T14:48:48+00:00\",\"description\":\"Learn to create measures with the Data Analysis Expressions (DAX) with online tutorial. Start preparing for Microsoft Exam DA-100 Now!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/create-measures-with-the-data-analysis-expressions-dax\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.testpreptraining.ai\/tutorial\/create-measures-with-the-data-analysis-expressions-dax\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/create-measures-with-the-data-analysis-expressions-dax\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.testpreptraining.ai\/tutorial\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create Measures with the Data Analysis Expressions (DAX)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#website\",\"url\":\"https:\/\/www.testpreptraining.ai\/tutorial\/\",\"name\":\"Testprep Training Tutorials\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.testpreptraining.ai\/tutorial\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#organization\",\"name\":\"Testprep Training\",\"url\":\"https:\/\/www.testpreptraining.ai\/tutorial\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.testpreptraining.com\/tutorial\/wp-content\/uploads\/2020\/07\/tpt-logo-6.png\",\"contentUrl\":\"https:\/\/www.testpreptraining.com\/tutorial\/wp-content\/uploads\/2020\/07\/tpt-logo-6.png\",\"width\":583,\"height\":153,\"caption\":\"Testprep Training\"},\"image\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Create Measures with the Data Analysis Expressions (DAX) | Testprep","description":"Learn to create measures with the Data Analysis Expressions (DAX) with online tutorial. Start preparing for Microsoft Exam DA-100 Now!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.testpreptraining.ai\/tutorial\/create-measures-with-the-data-analysis-expressions-dax\/","og_locale":"en_US","og_type":"article","og_title":"Create Measures with the Data Analysis Expressions (DAX) | Testprep","og_description":"Learn to create measures with the Data Analysis Expressions (DAX) with online tutorial. Start preparing for Microsoft Exam DA-100 Now!","og_url":"https:\/\/www.testpreptraining.ai\/tutorial\/create-measures-with-the-data-analysis-expressions-dax\/","og_site_name":"Testprep Training Tutorials","article_modified_time":"2021-01-22T14:48:48+00:00","og_image":[{"url":"https:\/\/docs.microsoft.com\/en-us\/power-bi\/transform-model\/media\/desktop-tutorial-create-measures\/meastut_netsales_byrcn.png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/create-measures-with-the-data-analysis-expressions-dax\/","url":"https:\/\/www.testpreptraining.ai\/tutorial\/create-measures-with-the-data-analysis-expressions-dax\/","name":"Create Measures with the Data Analysis Expressions (DAX) | Testprep","isPartOf":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#website"},"datePublished":"2021-01-22T14:48:46+00:00","dateModified":"2021-01-22T14:48:48+00:00","description":"Learn to create measures with the Data Analysis Expressions (DAX) with online tutorial. Start preparing for Microsoft Exam DA-100 Now!","breadcrumb":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/create-measures-with-the-data-analysis-expressions-dax\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.testpreptraining.ai\/tutorial\/create-measures-with-the-data-analysis-expressions-dax\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/create-measures-with-the-data-analysis-expressions-dax\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.testpreptraining.ai\/tutorial\/"},{"@type":"ListItem","position":2,"name":"Create Measures with the Data Analysis Expressions (DAX)"}]},{"@type":"WebSite","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#website","url":"https:\/\/www.testpreptraining.ai\/tutorial\/","name":"Testprep Training Tutorials","description":"","publisher":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.testpreptraining.ai\/tutorial\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#organization","name":"Testprep Training","url":"https:\/\/www.testpreptraining.ai\/tutorial\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#\/schema\/logo\/image\/","url":"https:\/\/www.testpreptraining.com\/tutorial\/wp-content\/uploads\/2020\/07\/tpt-logo-6.png","contentUrl":"https:\/\/www.testpreptraining.com\/tutorial\/wp-content\/uploads\/2020\/07\/tpt-logo-6.png","width":583,"height":153,"caption":"Testprep Training"},"image":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages\/33703","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/comments?post=33703"}],"version-history":[{"count":5,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages\/33703\/revisions"}],"predecessor-version":[{"id":33719,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages\/33703\/revisions\/33719"}],"wp:attachment":[{"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/media?parent=33703"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/categories?post=33703"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/tags?post=33703"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}