{"id":8561,"date":"2022-07-05T06:56:00","date_gmt":"2022-07-05T04:56:00","guid":{"rendered":"https:\/\/expert-only-com.preview-domain.com\/?p=8561"},"modified":"2022-07-07T16:13:58","modified_gmt":"2022-07-07T14:13:58","slug":"organize-ssas-measures-in-folders-with-mdx","status":"publish","type":"post","link":"https:\/\/expert-only.com\/en\/ssas\/organize-ssas-measures-in-folders-with-mdx\/","title":{"rendered":"Organize SSAS measures in folders with MDX"},"content":{"rendered":"\n<p>How to hide and organize SSAS measures in folders with MDX code ? And allow the possibility to group them for Analysis Services end-users? Indeed, browsing an SSAS cube from Microsoft Excel or Power BI for Ad-Hoc Reporting is very convenient.<\/p>\n\n\n\n<p>However, if the list of measures calculated in MDX is several tens or hundreds of items, they must be classified. Ideally, they should be classified by functional groups. And by sub-groups organised by the time axis.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-mdx-code-to-organize-ssas-measures-into-folders\">MDX code to organize SSAS measures into folders<\/h2>\n\n\n\n<p>First, all measures calculated in <a href=\"https:\/\/corporatefinanceinstitute.com\/resources\/knowledge\/accounting\/year-to-date-ytd\/\" target=\"_blank\" rel=\"noreferrer noopener\">YTD<\/a> will be close to the current value. Here is a deliberately simple but explicit example for classifying SSAS indicators in folders:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Sales<\/strong><ul><li>Sales YTD (Year-To-Date)<\/li><li>Sales MTD (Month-To-Date)<\/li><li>Sales LY (Last Year)<\/li><li>Sales LM (Last Month)<\/li><\/ul><\/li><li><strong>Stock<\/strong><ul><li>Stock YTD (Year-To-Date)<\/li><li>Stock MTD (Month-To-Date)<\/li><li>Stock LY (Last Year)<\/li><li>Stock LM (Last Month)<\/li><\/ul><\/li><\/ul>\n\n\n\n<p>This is because financial data is often associated with the past year, the past quarter and the past month.<\/p>\n\n\n\n<p>On the other hand, it is preferable to classify the measures in a functional way rather than in technical files. For greater usability in Reporting from cubes, the following properties are very useful:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>MDX DISPLAY_FOLDER<\/strong><\/li><li><strong>VISIBLE<\/strong><\/li><li><strong>FORMAT_STRING<\/strong><\/li><\/ul>\n\n\n\n<p>Secondly, this example of MDX code creates a calculated indicator based on a group of measures in our &#8220;.cube&#8221; file. This group of measures usually contains one or more fields from a table previously created in the Data View named &#8220;Example_View.dsv&#8221;:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">CREATE MEMBER CURRENTCUBE.[Measures].[Area - Sales] AS [Measures].[Amount - Group],\nFORMAT_STRING = \"#,##0.00 \u20ac;-#,##0.00 \u20ac\",\nVISIBLE = 1 ,\nDISPLAY_FOLDER = 'Sales';<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Explanation of the MDX code to structure calculated measures in a folder<\/h3>\n\n\n\n<p>Finally, this example MDX script allows you to easily hide and organize SSAS measures into folders. Code explanation :<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Start by creating the indicator in the cube and indicating the group of measures on which the SSAS indicator is based with the command &#8220;MDX CREATE MEMBER &lt;\u2026&gt; AS &#8220;.<\/li><li>Then indicate the data format which will be separated by a comma every 3 digits. Or with 2 digits after the comma and in euro currency (\u20ac sign) using the <strong>FORMAT_STRING<\/strong> property.<\/li><li>Set the MDX property <strong>VISIBLE<\/strong> to 1 to display the indicator to users. To be checked from the explorer and the SSAS connection from Excel or Power BI for example.<\/li><li>Indicate which folder will contain the calculated indicator with the <strong>DISPLAY_FOLDER<\/strong> property. In our cube example, the indicator will be visible in the &#8220;Sales&#8221; folder.<\/li><\/ol>\n\n\n\n<p>Finally, this short SSAS tutorial explains step by step how to organize SSAS measures in folders with a simple MDX script. To go further in Microsoft OLAP learning, here is another article on <strong><a href=\"https:\/\/expert-only.com\/en\/concepts\/xmla-stands-for-xml-for-analysis\/\">XMLA language<\/a><\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-tutoriels-et-exemples-sql-server-et-microsoft-it wp-block-embed-tutoriels-et-exemples-sql-server-et-microsoft-it\"><div class=\"wp-block-embed__wrapper\">\nhttps:\/\/expert-only.com\/en\/it-concepts\/xmla-stands-for-xml-for-analysis\/\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>How to hide and organize SSAS measures in folders with MDX code ? And allow the possibility to group them for Analysis Services end-users? Indeed, browsing an SSAS cube from Microsoft Excel or Power BI for Ad-Hoc Reporting is <a class=\"mh-excerpt-more\" href=\"https:\/\/expert-only.com\/en\/ssas\/organize-ssas-measures-in-folders-with-mdx\/\" title=\"Organize SSAS measures in folders with MDX\">&#8230;<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":5591,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[600],"tags":[],"class_list":{"0":"post-8561","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-ssas"},"_links":{"self":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/8561","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/comments?post=8561"}],"version-history":[{"count":0,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/8561\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media\/5591"}],"wp:attachment":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media?parent=8561"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/categories?post=8561"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/tags?post=8561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}