{"id":3477,"date":"2022-02-04T15:30:47","date_gmt":"2022-02-04T14:30:47","guid":{"rendered":"https:\/\/devstage.bix-consulting.com\/?p=3477"},"modified":"2023-05-24T09:42:54","modified_gmt":"2023-05-24T07:42:54","slug":"sql-im-composite-provider","status":"publish","type":"post","link":"https:\/\/teststage.bix-consulting.com\/en\/sql-im-composite-provider\/","title":{"rendered":"SQL in the Composite Provider - Powerful Function but Possibly Surprising Calculations"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8220;1&#8243; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_row _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_column type=&#8220;4_4&#8243; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_text _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;]<\/p>\n<p style=\"text-align: justify;\"><span data-contrast=\"auto\">In a composite provider, you can now fill new characteristics or key figures using your own SQL!<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\"><span data-contrast=\"auto\">This is an exciting function that can be used to elegantly solve many requirements. If you use this for key figures, however, it can happen that the result does not quite meet expectations and even changes if you include other key figures in the drilldown. Therefore, the behaviour will be analysed and explained here with a simple example. Then nothing will stand in the way of using this powerful function without any \"nasty\" surprises.\u00a0<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\"><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">The blog is structured as follows:<\/span><\/p>\n<ul>\n<li style=\"text-align: justify;\"><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">Presentation of the new functionality<\/span><\/li>\n<li style=\"text-align: justify;\"><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">Explanation of the small example<\/span><\/li>\n<li style=\"text-align: justify;\"><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">Surprising results<\/span><\/li>\n<li style=\"text-align: justify;\"><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">Avoiding the \"wrong\" calculation <span data-contrast=\"auto\" style=\"font-size: 11pt; line-height: 18px; font-family: Calibri, 'Calibri_EmbeddedFont', 'Calibri_MSFontService', sans-serif;\" xml:lang=\"DE-DE\" class=\"TextRun SCXW181963163 BCX2\" lang=\"DE-DE\"><span class=\"NormalTextRun SCXW181963163 BCX2\" data-ccp-parastyle=\"Normal (Web)\">\u201e<\/span><\/span>falschen&#8220; Berechnung<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\"><\/span><\/li>\n<\/ul>\n<p><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\"><\/span><\/p>\n<p><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\"><\/span><\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;]<\/p>\n<h4 style=\"text-align: justify;\">The new functionality<\/h4>\n<p style=\"text-align: justify;\"><span data-contrast=\"auto\">If BW\/4 is at a sufficient patch level (HANA 2.0 SPS 04), you will see the following new option in the composite provider:<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_column type=&#8220;4_4&#8243; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_image src=&#8220;https:\/\/teststage.bix-consulting.com\/wp-content\/uploads\/2022\/02\/blogbild1.png&#8220; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_column type=&#8220;4_4&#8243; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_text _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;]<\/p>\n<p style=\"text-align: justify;\"><span data-contrast=\"auto\">To generate a key figure from a numerical attribute, the following SQL is now sufficient:<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\"><span data-contrast=\"auto\">\u00a0\u202f<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\"><span data-contrast=\"auto\">snumc_to_int( &#8222;ATTRIBUTE_NUMC&#8220; )<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\"><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\"><span data-contrast=\"auto\">This makes the composite provider much more powerful and probably avoids the use of a calculation view or the creation and filling of a new key figure\/characteristic in the aDSO. In particular, avoiding the Calculation View helps to avoid introducing yet another technique. In addition, access directly to HANA is not always desired.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\"> <\/span><span data-contrast=\"auto\">\u202f<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\" class=\" translation-block\"><span data-contrast=\"auto\">This function is well described in the SAP release information  (<\/span><a href=\"https:\/\/help.sap.com\/viewer\/b3701cd3826440618ef938d74dc93c51\/2.0.6\/de-DE\/d8b12ec099e04e6aa77a312be687db63.html\" target=\"_self\"><span data-contrast=\"none\">https:\/\/help.sap.com\/viewer\/b3701cd3826440618ef938d74dc93c51\/2.0.6\/de-DE\/d8b12ec099e04e6aa77a312be687db63.html<\/span><\/a><span data-contrast=\"auto\">) and in this nice blog<\/span><span>\u00a0<\/span><span data-contrast=\"auto\"><\/span><a href=\"https:\/\/www.brandeis.de\/en\/blog\/sql-expressions-in-bw-4hana-composite-provider-hcpr\/\" target=\"_self\"><span data-contrast=\"none\">https:\/\/www.brandeis.de\/en\/blog\/sql-expressions-in-bw-4hana-composite-provider-hcpr\/<\/span><\/a><span>\u00a0 <\/span><span data-contrast=\"auto\"><\/span><span>\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\"><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\"><\/span><\/p>\n<p style=\"text-align: justify;\"><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\"><\/span><\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;]<\/p>\n<h4>Small example<\/h4>\n<p style=\"text-align: justify;\" class=\" translation-block\">Let's take a look at the following example. (The example does not claim to make any technical sense, it is only intended to make the results easy to understand with simple numbers and calculations ? Likewise, there may be other approaches to solving the problems, but these will not be considered here. We only want to understand the function of the SQL processing).<\/p>\n<p style=\"text-align: justify;\"><span data-contrast=\"auto\">We have an aDSO that is structured as follows:<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_column type=&#8220;4_4&#8243; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_image src=&#8220;https:\/\/teststage.bix-consulting.com\/wp-content\/uploads\/2022\/02\/blogbild2l.png&#8220; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_column type=&#8220;4_4&#8243; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_text _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;]<\/p>\n<p style=\"text-align: justify;\"><span data-contrast=\"auto\">Now we want to add the following key figures in the Calculation View:<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\"><b><span data-contrast=\"auto\">Weight quantity with month, i.e. quantity in January * 1, February *2 etc.<\/span><\/b><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\"><span data-contrast=\"auto\">So that all steps can be controlled, these are created as individual characteristics or key figures. Of course, this would also be possible in one step<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\"><span data-contrast=\"auto\">In a first step, we get the month from 0CALMONTH.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_column type=&#8220;4_4&#8243; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_image src=&#8220;https:\/\/teststage.bix-consulting.com\/wp-content\/uploads\/2022\/02\/blogbild3.png&#8220; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_column type=&#8220;4_4&#8243; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_text _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;]<\/p>\n<p>Then we convert the month into a key figure.<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_column type=&#8220;4_4&#8243; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_image src=&#8220;https:\/\/teststage.bix-consulting.com\/wp-content\/uploads\/2022\/02\/blogbild4.png&#8220; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_column type=&#8220;4_4&#8243; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_text _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;]<\/p>\n<p>Finally, multiply by the quantity.<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_column type=&#8220;4_4&#8243; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_image src=&#8220;https:\/\/teststage.bix-consulting.com\/wp-content\/uploads\/2022\/02\/blogbild5.png&#8220; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_column type=&#8220;4_4&#8243; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_text _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;]<\/p>\n<p style=\"text-align: justify;\"><span data-contrast=\"auto\">In another example, the entries with EUR as currency are to be counted, i.e. the key figure should always contain 1 if the currency contains EUR. This can be done with the following SQL statement:<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">CASE &#8222;0LOC_CURRCY&#8220;<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 WHEN &#8218;EUR&#8216; THEN 1<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ELSE 0<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">\u00a0END<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\"><\/span><\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_column type=&#8220;4_4&#8243; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_text _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;]<\/p>\n<h4>Surprising results<\/h4>\n<p>If all attributes are drilled down, the calculation is done as we intuitively expect:<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_column type=&#8220;4_4&#8243; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_image src=&#8220;https:\/\/teststage.bix-consulting.com\/wp-content\/uploads\/2022\/02\/blogbild6.png&#8220; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_column type=&#8220;4_4&#8243; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_text _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;]<\/p>\n<p><span data-contrast=\"auto\">If no attributes are displayed in the simple query \/ listcube, we get the following result:<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<ul>\n<li><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">counting the months with EUR delivers one month too few (penultimate, expected 4, now 3)<\/span><\/li>\n<li><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">the sum of the months as a key figure gives a different result (last column, expected 22, now 21)<\/span><\/li>\n<\/ul>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_column type=&#8220;4_4&#8243; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_image src=&#8220;https:\/\/teststage.bix-consulting.com\/wp-content\/uploads\/2022\/02\/blogbild7.png&#8220; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_column type=&#8220;4_4&#8243; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_text _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;]<\/p>\n<p style=\"text-align: justify;\"><span data-contrast=\"auto\">It gets even more confusing if we only look at the key figure for counting the months with EUR and display the currency.  Both times we have the currency in the rows, and only the one key figure in the column, but beware:\u00a0<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<ul>\n<li style=\"text-align: justify;\"><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">The report on the composite that filters the key figure gives the expected result of 4, but in total, only 3!<\/span><\/li>\n<\/ul>\n<p>[\/et_pb_text][et_pb_image src=&#8220;https:\/\/teststage.bix-consulting.com\/wp-content\/uploads\/2022\/02\/blogbild8.png&#8220; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][\/et_pb_image][et_pb_text _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;]<\/p>\n<ul>\n<li>If you save the workbook and refresh it, the total result is suddenly displayed as 4, as expected.<\/li>\n<\/ul>\n<p>[\/et_pb_text][et_pb_image src=&#8220;https:\/\/teststage.bix-consulting.com\/wp-content\/uploads\/2022\/02\/blogbild13.png&#8220; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][\/et_pb_image][et_pb_text _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;]<\/p>\n<ul>\n<li>A query with only one key figure in the columns, however, only returns 1.<\/li>\n<\/ul>\n<p>[\/et_pb_text][et_pb_image src=&#8220;https:\/\/teststage.bix-consulting.com\/wp-content\/uploads\/2022\/02\/blogbild9.png&#8220; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_column type=&#8220;4_4&#8243; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_text _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;]<\/p>\n<h4>Reason for the \"wrong\" results<\/h4>\n<p style=\"text-align: justify;\"><span data-contrast=\"auto\">To optimise performance, the data is always aggregated as much as possible first and then the SQL for the new characteristics is executed in the composite provider.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\"> <br \/><\/span><\/p>\n<p style=\"text-align: justify;\"><span data-contrast=\"auto\">So if two attributes are needed in the calculation, the data is aggregated to that level, the calculation is performed and then aggregated further if needed for the display.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\"><span data-contrast=\"auto\">The calculation of all key figures used is carried out on the same level, i.e. if several calculations have to be carried out, then aggregation is only carried out to the extent that everything can be calculated at the same time.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\"><span data-contrast=\"auto\">This means that the calculations can be different, depending on which key figures are to be displayed at the same time. If all characteristics are in the drilldown, then the calculation takes place at the lowest level.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\"><span data-contrast=\"auto\">\u202f<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\"><span data-contrast=\"auto\">In our case, the month and currency are needed to perform the calculation for all formulas as expected. Therefore, if all key figures occur but no characteristics are in the drilldown, the calculation is first summarised to this level. The fact that we have figures in EUR in two company codes in January does not matter, as this line only occurs once and is therefore only counted once. Therefore, we only get a 3 here instead of the 4. If we also let the currency be displayed, then another logic seems to apply to the individual lines, which now leads to a 4 here again. It gets even more confusing if you save this representation and update it again. Then all of a sudden, the overall result is correct.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\"><span data-contrast=\"auto\">If we have only requested the key figure for counting the EUR numbers in the query, then a summarisation down to the currency takes place here before the SQL is executed. Therefore, we get the 1 for once expression EUR.<\/span><\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_column type=&#8220;4_4&#8243; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_text _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;]<\/p>\n<h4 aria-level=\"2\"><span data-contrast=\"none\">Force \"correct\" calculation<br \/><\/span><\/h4>\n<p style=\"text-align: justify;\"><span data-contrast=\"auto\">Fortunately, there is the possibility to convince the query to calculate \"correctly\".<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\"><span data-contrast=\"auto\">To do this, we need to change two settings. First, we create a formula that takes the actual key figure and for which we define the exception aggregation:<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8220;https:\/\/teststage.bix-consulting.com\/wp-content\/uploads\/2022\/02\/blogbild10.png&#8220; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_column type=&#8220;4_4&#8243; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_text _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;]<\/p>\n<p style=\"text-align: justify;\"><span data-contrast=\"auto\">All features that we want to take into account in the calculation are to be entered as reference features. Since a maximum of 5 characteristics are allowed here, this procedure is certainly not suitable for every model. But often we do not need all characteristics of the model here, but only those that can differ independently or that are to be considered in the count. For example, in many models the document number is probably sufficient.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\"><span data-contrast=\"auto\">Surprisingly, this exception aggregation alone still does not result in a correct calculation. Only when the setting \"Calculate. Commut. Formula according to aggregate:\" is set to Yes, the \"correct\" result comes out:<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_column type=&#8220;4_4&#8243; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_image src=&#8220;https:\/\/teststage.bix-consulting.com\/wp-content\/uploads\/2022\/02\/blogbild11.png&#8220; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_column type=&#8220;4_4&#8243; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_image src=&#8220;https:\/\/teststage.bix-consulting.com\/wp-content\/uploads\/2022\/02\/blogbild12.png&#8220; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_column type=&#8220;4_4&#8243; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_text _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;]<\/p>\n<p style=\"text-align: justify;\"><span data-contrast=\"auto\">We have not tried whether you can force the calculation on a lower level by addressing the characteristics in the formula or assigning them to a key figure for which an exception aggregation is stored. As always, there are certainly many more ways to get to the target.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\"><span data-contrast=\"auto\">Independently of the solution presented here, such a question can often also be solved in a query with formulas. However, this is then limited to a single query and has similar limitations.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<h4 aria-level=\"2\"><span data-contrast=\"none\">Conclusion<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h4>\n<p style=\"text-align: justify;\" class=\" translation-block\">Even if the explanations and the behaviour sound confusing at first, the software follows simple rules ? as always. Once these are understood, the new functionality can be used without any \"nasty\" surprises. Have fun!<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_column type=&#8220;4_4&#8243; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_text _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; text_font=&#8220;Roboto|300|||||||&#8220; text_font_size=&#8220;30px&#8220; locked=&#8220;off&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;]<\/p>\n<p style=\"text-align: center;\"><span style=\"color: #000000;\"><\/span><\/p>\n<p style=\"text-align: center;\"><span style=\"color: #000000;\">Contact Person<\/span><\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; hover_enabled=&#8220;0&#8243; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220; sticky_enabled=&#8220;0&#8243;][et_pb_column type=&#8220;4_4&#8243; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][et_pb_image src=&#8220;https:\/\/teststage.bix-consulting.com\/wp-content\/uploads\/2021\/09\/Ulrich_MesethRUND-e1631882904947.jpg&#8220; title_text=&#8220;Ulrich_MesethRUND&#8220; align=&#8220;center&#8220; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; locked=&#8220;off&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220;][\/et_pb_image][et_pb_text _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; text_font=&#8220;Roboto|300|||||||&#8220; hover_enabled=&#8220;0&#8243; locked=&#8220;off&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220; sticky_enabled=&#8220;0&#8243;]<\/p>\n<div class=\"elementor-image-box-content\">\n<h3 class=\"elementor-image-box-title\" style=\"text-align: center;\"><\/h3>\n<h3 class=\"elementor-image-box-title\" style=\"text-align: center;\"><\/h3>\n<h4 class=\"elementor-image-box-title\" style=\"text-align: center;\">\u00a0 Dr. Ulrich Meseth<\/h4>\n<p class=\"elementor-image-box-description\" style=\"text-align: center;\">\u00a0\u00a0 Senior Consultant<\/p>\n<\/div>\n<p>[\/et_pb_text][et_pb_social_media_follow _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; text_orientation=&#8220;center&#8220; locked=&#8220;off&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220; custom_padding=&#8220;13px|||||&#8220;][et_pb_social_media_follow_network url=&#8220;mailto:ulrich.meseth@bix-consulting.de?cc=vertrieb@bix-consulting.de&#8220; _builder_version=&#8220;4.16&#8243; _module_preset=&#8220;default&#8220; background_image=&#8220;https:\/\/teststage.bix-consulting.com\/wp-content\/uploads\/2020\/08\/E-Mail.png&#8220; background_enable_image=&#8220;on&#8220; background_size=&#8220;contain&#8220; global_colors_info=&#8220;{}&#8220; theme_builder_area=&#8220;post_content&#8220; follow_button=&#8220;off&#8220; url_new_window=&#8220;on&#8220;][\/et_pb_social_media_follow_network][\/et_pb_social_media_follow][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>","protected":false},"excerpt":{"rendered":"<p>In einem Composite-Provider kann man nun neue Merkmale oder Kennzahlen per eigenem SQL f\u00fcllen!\u00a0 Dies ist eine spannende Funktion, mit der man viele Anforderungen elegant l\u00f6sen kann. Verwendet man dies bei Kennzahlen, kann es jedoch passieren, dass das Ergebnis nicht ganz den Erwartungen entspricht und sich sogar noch ver\u00e4ndert, wenn man andere Kennzahlen mit in [&hellip;]<\/p>","protected":false},"author":6,"featured_media":3479,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[18],"tags":[],"modified_by":"admin","_links":{"self":[{"href":"https:\/\/teststage.bix-consulting.com\/en\/wp-json\/wp\/v2\/posts\/3477"}],"collection":[{"href":"https:\/\/teststage.bix-consulting.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/teststage.bix-consulting.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/teststage.bix-consulting.com\/en\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/teststage.bix-consulting.com\/en\/wp-json\/wp\/v2\/comments?post=3477"}],"version-history":[{"count":0,"href":"https:\/\/teststage.bix-consulting.com\/en\/wp-json\/wp\/v2\/posts\/3477\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/teststage.bix-consulting.com\/en\/wp-json\/wp\/v2\/media\/3479"}],"wp:attachment":[{"href":"https:\/\/teststage.bix-consulting.com\/en\/wp-json\/wp\/v2\/media?parent=3477"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/teststage.bix-consulting.com\/en\/wp-json\/wp\/v2\/categories?post=3477"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/teststage.bix-consulting.com\/en\/wp-json\/wp\/v2\/tags?post=3477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}