<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>Dave's Adventures in Business Intelligence &#187; Variables!</title>
	<atom:link href="http://www.dagira.com/category/report-techniques/variables/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dagira.com</link>
	<description>...you are in a twisty maze of passageways, all different...</description>
	<lastBuildDate>Wed, 28 Jul 2010 13:13:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<!-- podcast_generator="podPress/8.8" -->
		<copyright>&#xA9; </copyright>
		<managingEditor>blogmaster@dagira.com ()</managingEditor>
		<webMaster>blogmaster@dagira.com()</webMaster>
		<category></category>
		<ttl>1440</ttl>
		<itunes:keywords></itunes:keywords>
		<itunes:subtitle></itunes:subtitle>
		<itunes:summary>...you are in a twisty maze of passageways, all different...</itunes:summary>
		<itunes:author></itunes:author>
		<itunes:category text="Society &amp; Culture"/>
		<itunes:owner>
			<itunes:name></itunes:name>
			<itunes:email>blogmaster@dagira.com</itunes:email>
		</itunes:owner>
		<itunes:block>No</itunes:block>
		<itunes:explicit>no</itunes:explicit>
		<itunes:image href="http://www.dagira.com/wp-content/plugins/podpress/images/powered_by_podpress_large.jpg" />
		<image>
			<url>http://www.dagira.com/wp-content/plugins/podpress/images/powered_by_podpress.jpg</url>
			<title>Dave's Adventures in Business Intelligence</title>
			<link>http://www.dagira.com</link>
			<width>144</width>
			<height>144</height>
		</image>
		<item>
		<title>Want To Remove Drill Indicators? Use A Variable&#8230;</title>
		<link>http://www.dagira.com/2010/07/07/want-to-remove-drill-indicators-use-a-variable/</link>
		<comments>http://www.dagira.com/2010/07/07/want-to-remove-drill-indicators-use-a-variable/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 12:38:54 +0000</pubDate>
		<dc:creator>Dave Rathbun</dc:creator>
				<category><![CDATA[Report Techniques]]></category>
		<category><![CDATA[Variables!]]></category>

		<guid isPermaLink="false">http://www.dagira.com/?p=298</guid>
		<description><![CDATA[In some cases I have created reports that were in drill mode that were not really drillable. For example, I showed a technique a few years back that would let a report developer swap measures out on a chart using a drill filter. It has been working great for quite a few years now. However, [...]]]></description>
			<content:encoded><![CDATA[<p>In some cases I have created reports that were in drill mode that were not really drillable. For example, I showed a technique a few years back that would let a report developer swap measures out on a chart using a drill filter. It has been working great for quite a few years now. However, as a side effect any dimension on the report blocks that participates in a hierarchy becomes drillable. Sometimes I don&#8217;t want that, and there is an easy fix. <span id="more-298"></span></p>
<h3>Problem Definition</h3>
<p>When building a universe there are three types of result objects that I can build: dimensions, details, and measures. All dimensions are by default drillable, and the order of the objects in the class determines the default hierarchy. (That&#8217;s one of many reasons why trying to order objects in alphabetical order just does not work.) I can eliminate the default hierarchies (and allow my objects to be ordered alphabetically if I really need to) by creating custom hierarchies. That&#8217;s a subject for another blog post.</p>
<p>What I want to talk about today is how to eliminate all drill opportunities on a report, no matter whether I have used default or custom hierarchies. I want to be able to include dimension objects, put my report into drill mode, but not be able to drill on every possible dimension. Here&#8217;s how to do that.</p>
<h3>Demote the Dimension Using a Variable</h3>
<p>When I use a dimension object in my block and that dimension participates in a drill hierarchy and my report is in drill mode I will see the drill indicators. In the Web Intelligence Rich Client they look like this:</p>
<p><img src="/tips/drill_variable/drill_filter.png" width="325" height="100" border="0" alt="Screen shot showing drillable block in Web Intelligence" title="Indicators that a block is drillable in a Web Intelligence document" /></p>
<p>The &#8220;up arrow&#8221; implies that I can drill up. The underline format on the resort names implies that I can drill down. Here is a very simple fix if I don&#8217;t want either of those interface elements to appear. Create a variable that references the dimension, and use the variable instead. For this example, I will create a variable called Resort Name that has the simple formula <code>=[Resort]</code>. Once I do that, and I replace the original Resort object with my new variable, here is what the block looks like when the report is in drill mode:</p>
<p><img src="/tips/drill_variable/no_drill.png" width="325" height="100" border="0" alt="Screen shot showing non-drillable block in Web Intelligence" title="After demotion the column (variable) is no longer drillable" /></p>
<p>Problem solved. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_cool.gif' alt='8-)' class='wp-smiley' /> The reason this works is that variables &#8211; even simple ones like this &#8211; are not drillable. Only dimension objects that come from the universe can be drilled. By converting a dimension to a variable it will no longer show any drill indicators when a report block is in drill mode. Why would I want to do that? As mentioned in the first paragraph of this post, I showed a trick several years ago that allows me to switch measures on a block by changing a selection in a drill filter. In order to do that, the report has to be in drill mode. I will write up that one soon, or you can read about it in Tales of a Universe Ninja, Part II, found on my <a href="http://www.dagira.com/conference-presentations/">conference presentations page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dagira.com/2010/07/07/want-to-remove-drill-indicators-use-a-variable/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Displaying UserResponse() Values On Separate Rows</title>
		<link>http://www.dagira.com/2009/11/25/displaying-userresponse-values-on-separate-rows/</link>
		<comments>http://www.dagira.com/2009/11/25/displaying-userresponse-values-on-separate-rows/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 12:00:22 +0000</pubDate>
		<dc:creator>Dave Rathbun</dc:creator>
				<category><![CDATA[Report Techniques]]></category>
		<category><![CDATA[Variables!]]></category>
		<category><![CDATA[Web Intelligence]]></category>

		<guid isPermaLink="false">http://www.dagira.com/?p=227</guid>
		<description><![CDATA[I am often asked why I still participate so much on BOB after all of these years. The main reason is I still get inspired by questions that make me think a little bit. The puzzle for today&#8217;s post was presented as a question something like this:
How can I display each individual value selected in [...]]]></description>
			<content:encoded><![CDATA[<p>I am often asked why I still participate so much on BOB after all of these years. The main reason is I still get inspired by questions that make me think a little bit. The puzzle for today&#8217;s post was presented as a question something like this:</p>
<blockquote><p>How can I display each individual value selected in the UserResponse() function on its own row in a table?</p></blockquote>
<p>I believe the reason for wanting this behavior is fairly clear. If you have a bunch of complex data it would be much easier for the report consumer to read this:</p>
<p><code>XYZ123ABC<br />
DEF456HIJ<br />
BOB111BOB</code></p>
<p>Instead of this:</p>
<p><code>XYZ123ABC;DEF456HIJ;BOB111BOB</code></p>
<p>As is often the case, the strict answer to the question is &#8220;you can&#8217;t do it that way&#8221; with Web Intelligence. Despite the &#8220;you can&#8217;t&#8230;&#8221; answer I am going to show how it can be done. </p>
<p><span id="more-227"></span></p>
<h3>Printer History Lesson aka Carriage Return + Line Feed To The Rescue</h3>
<p>Before I show my solution, I have a history lesson to share. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  In the old days (and I mean really old, like before laser printers) most business printing was done with impact printers. An impact printer was essentially a typewriter connected to a computer. It would print one character at a time. Some really expensive printers could write an entire line at a time. Some even more expensive ones would be able to write forwards and backwards to save time. Fancy stuff. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_lol.gif' alt=':lol:' class='wp-smiley' />  But the point is, everything was characters and lines. If a program needed to print something bold, the printer would back up and print the same characters more than once on the same line. That&#8217;s where special printer control characters came in.</p>
<p>The print head or &#8220;carriage&#8221; was where the next character would be printed. Normally it would flow across the page printing one character at a time. At the end of the line, a carriage return signal was sent. This would tell the printer to send the carriage all the way back to the beginning of the line. If the printer started printing again at that point, it would overwrite the existing line of output. (As mentioned above, that&#8217;s one way that bold type was done.) To avoid this, another special printer instruction character was sent just before the printing started: the line feed. This character told the paper to roll the paper forward one line so that the new output would be on the next line.</p>
<p>To recap: carriage return sends the print head back to the left side of the page, and line feed moved the paper forward one line. Carriage return was (and still is) character 13 in the ASCII sequence, and line feed is character 10. (These are also often abbreviated CR and LF.) There are plenty of others. If my memory is correct a tab is character 9 and the &#8220;bell&#8221; if you wanted the printer to make a noise was character 7. But I digress.</p>
<p>Fast forward to today. The characters still retain some of their meanings, even if we don&#8217;t use impact printers anymore. So if I want to push some content down and start on a new line, I can include these characters as part of my output and they will behave the same way. Web Intelligence offers the function <code>Char()</code> which will allow me to introduce a specific character using the proper number. Web Intelligence also offers the <code>Replace()</code> function which will allow me to replace one character (or string) with another character (or string). You might see where all of this is heading&#8230;</p>
<h3>Prompt Processing</h3>
<p>I created a simple query using the Prestige Motors universe. The query includes a prompt that asks the user to select one or more automobile manufacturers when the report is refreshed. The text of the prompt is &#8220;Car Makers.&#8221; I can easily display the results of the prompt (the values the user selected) on my report using the <code>UserResponse()</code> function. What I want to do is display each selected value on its own line.</p>
<p>How am I going to accomplish this? I&#8217;m not going to put each value on an individual row in a table. As I already said that can&#8217;t be done. Instead, I&#8217;m going to make them show up on different rows in a single cell. The readability should be the same, even if the applied technique is different.</p>
<p>The final piece of the puzzle is to observe just how Web Intelligence captures and displays prompt responses. Here is a screen shot showing the prompt after I have selected four different car makers. Notice that the four values are separated by the semicolon ; character.</p>
<p><img src="/tips/response_lines/prompt.jpg" width="395" height="96" border="0" alt="Prompt dialog box" title="Prompt selections shown in a Web Intelligence Rich Client" /></p>
<p>With a simple formula I can echo the prompt selections in my report title cell like this:</p>
<p><img src="/tips/response_lines/standard_output.jpg" width="325" height="174" border="0" alt="Standard report output" title="Web Intelligence Rich Client standard report output from a user response" /></p>
<p>Notice that the exact same format is used in both the prompt window and the output in the title cell. Each selected value is separated by a semicolon. I can work with this.</p>
<h3>The Solution</h3>
<p>I created a variable named &#8220;Picked Cars&#8221; with this formula:</p>
<p><code>=Replace(UserResponse("Car Makers");";";Char(13)+Char(10))</code></p>
<p>The inside portion of the formula looks like this:</p>
<p><code>UserResponse("Car Makers")</code></p>
<p>That bit captures the selections and returns them in the format shown above, where each car name is separated by a semicolon. The outer portion of the formula uses the <code>Replace()</code> function to find those semicolon characters and replace them with the combination of character 13 (CR) and 10 (LF). The net result?</p>
<p>Everywhere there is a ; it gets replaced by the CR+LF and therefore the output moves down to a new line and back to the left side of the page. Strictly speaking there is no page nor is there any paper to &#8220;line feed&#8221; but the functionality is the same. Simple enough. Here&#8217;s what the results looked like after I created this variable and used it in my header.</p>
<p><img src="/tips/response_lines/revised_output.jpg" width="336" height="232" border="0" alt="Alternate report format" title="Web Intelligence Rich Client adjusted user response format" /></p>
<p>What about the formatting? It turns out I didn&#8217;t need to do too much. I made sure that my cell was set to automatically fit the content (since it could grow or shrink based on how many cars were selected) using the &#8220;Autofit Height&#8221; setting as shown here.</p>
<p><img src="/tips/response_lines/cell_properties.jpg" width="600" height="380" border="0" alt="cell properties" title="Web Intelligence Rich Client cell properties with Autofit Height turned on" /></p>
<p>The next item I planned to update turned out to be set for me by default. (This example was documented using the Web Intelligence Rich Client so other tools may require this step.) I clicked on the edge of the block and made sure that if the title cell above it grew too big that the block would move down the page. This is done by setting the relative positioning of the block, as shown here.</p>
<p><img src="/tips/response_lines/block_properties.jpg" width="492" height="324" border="0" alt="block properties" title="Web Intelligence Rich Client block properties for automatic alignment" /></p>
<p>As I mentioned, this dialog box did not require any changes for this scenario. It was already set the way I needed it to be. Since the block is positioned relative to the cell that contains my [Picked Cars] variable it will move up or down the page based on the size (height in this case) of the cell.</p>
<h3>Conclusion</h3>
<p>Can I split out each individual user response and display it on a separate row in a table? No. Can I achieve the same visual result using other techniques? Sure. That&#8217;s what it&#8217;s all about, finding a different way to answer a question. This solution does have one problem&#8230; it will not work cleanly if there are semicolon characters in the data returned from the prompt. I did not test this with Desktop Intelligence, but since it includes all of the functions used in this example I am confident that it would work the same way.</p>
<p>I was challenged when I posted this solution on BOB as to why I used both CR and LF characters in my formula. To be honest, when I changed the formula so that it only included one or the other, either seemed to work just fine individually. Despite this, I opted to leave both in my formula.</p>
<p>What can I say&#8230; old habits die hard. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_cool.gif' alt='8-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.dagira.com/2009/11/25/displaying-userresponse-values-on-separate-rows/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>Constants, Formulas, and Variables, Oh My!</title>
		<link>http://www.dagira.com/2009/11/03/constants-formulas-and-variables-oh-my/</link>
		<comments>http://www.dagira.com/2009/11/03/constants-formulas-and-variables-oh-my/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 11:39:36 +0000</pubDate>
		<dc:creator>Dave Rathbun</dc:creator>
				<category><![CDATA[2009 GBN - Dallas]]></category>
		<category><![CDATA[Report Techniques]]></category>
		<category><![CDATA[Variables!]]></category>

		<guid isPermaLink="false">http://www.dagira.com/?p=217</guid>
		<description><![CDATA[In the first post in this series I talked about different places I could place complex calculations. I reviewed some pros and cons of doing calculations during ETL, in the universe, or on a report. In this post I am going to focus only on report calculations. I will cover the formulas versus variables debate [...]]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://www.dagira.com/2009/10/28/calculation-options/">first post in this series</a> I talked about different places I could place complex calculations. I reviewed some pros and cons of doing calculations during ETL, in the universe, or on a report. In this post I am going to focus only on report calculations. I will cover the formulas versus variables debate and show a couple of tricks to make working with variables a little bit easier along the way.</p>
<p><em>This presentation covers slides 10 through 12 from my 2009 GBN presentation titled &#8220;Return of the Variables&#8221; which can be downloaded from my <a href="http://www.dagira.com/conference-presentations/">conference page</a>.</em> <span id="more-217"></span></p>
<h3>Constant, Formula, or Variable?</h3>
<p>A constant is a value that is never going to change. Constants are probably quite rare, to be honest. I could hard-code a sales tax rate into my report but it is far more likely that the tax rate will come from the database. Same for commission percentage or project deadline dates or any other data along those lines. In any case, they&#8217;re not really complex and they&#8217;re certainly not calculations so I will move on. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>That leaves formulas and variables. How are they different? How are they the same?</p>
<p>Both can use the full range of report engine functions. Both can be used just about anywhere on the report. Is there any reason to select one technique over the other?</p>
<p>Yes, yes there is.</p>
<h3>The Four Cs</h3>
<p>Years ago when I wrote my first Variables presentation I came up with what I called &#8220;The Four Cs&#8221; to describe why variables are better than formulas. They are:</p>
<ul>
<li><strong>Convenience</strong><br />
A variable can be used with every report feature. I can&#8217;t build an Alerter using a formula, as shown here:</p>
<p><img src="/tips/why_variables/alerter.png" width="341" height="231" border="2" alt="alerter screen" title="Variables are required for alerters; formulas do not work" /></p>
<p>I can&#8217;t rank on a formula. In Web Intelligence I get a list of query objects and a list of variables, but not formulas. The list probably goes on from there but that&#8217;s probably enough important features to prove the point. Variables can be used in places where formulas cannot be used.</li>
<li><strong>Clarity</strong><br />
Simply put, a variable is a formula with a name. A name defines the purpose of the calculation. It is much easier to understand a complex calculation like this:</p>
<p><code>=((100-[Discount Rate])/100)*[List Price]*[Qty Sold]</code></p>
<p>&#8230; when that formula is also named &#8220;Sale Value After Discount&#8221; and saved as a variable.</li>
<li><strong>Complexity</strong><br />
Sometimes it&#8217;s hard to figure out the syntax for a complex calculation. I will often break something down into simple steps and store the results as variables. Because variables can be reused (formulas cannot since they don&#8217;t have a name and therefore cannot be referenced) I can check my work at various points and make sure I am seeing the expected results. In another post related to this conference presentation I showed an alternative way to <a href="http://www.dagira.com/2009/10/23/calculating-business-days-between-two-days-via-report-functions/">calculate the number of business days between two dates</a>. If you review that post you will see that the formulas get quite complex indeed! <img src='http://www.dagira.com/wp-includes/images/smilies/icon_eek.gif' alt=':shock:' class='wp-smiley' />  You can bet that I didn&#8217;t come up with the final version without working carefully through each step. Using variables, of course.</li>
<li><strong>Consistency</strong><br />
Once a variable is built it appears on the list of report &#8220;components&#8221; saved as part of the document. I have touched on this aspect of variables already in this post. Because variables appear on this list they are reusable throughout the report. Because I can reuse them throughout the report I can edit them in one place and have the changes propagate everywhere I use that particular calculation. If I spend the time and effort to create and test a complex calculation, it&#8217;s nice to know that it is reusable and will therefore provide consistent results throughout my document.</li>
</ul>
<h3>Wish List: Universe (or Universal) Variable Repository</h3>
<p>At one point I had started writing a VBA script that would allow me to create report variables and check them into a &#8220;variable repository&#8221; that I stored in a Microsoft Access database. The idea was that once a variable was created I could then easily reuse it in other documents. This worked fine for desktop documents. Web Intelligence documents were not supported at all since the utility was based on VBA. It would be nice if we could see this feature supported directly in the universe framework.</p>
<h3>Building Variables</h3>
<p>Building variables in a document is fairly simple. I can click the proper button on the toolbar (shown below). </p>
<p><img src="/tips/why_variables/create_variable.png" width="475" height="286" border="2" alt="invoke variable editor" title="Invoking the variable editor via a toolbar button" /></p>
<p>After clicking this button I am presented with the following screen that allows me to create my local calculation. (Note: this screen is from XI 3.0 and is different from what you will see in prior versions.)</p>
<p><img src="/tips/why_variables/variable_editor.png" width="550" height="483" border="0" alt="variable editor" title="Creating a variable in a Web Intelligence report" /></p>
<p>This screen allows me to enter a name for my variable, set the qualification (dimension, detail, or measure), and access the full range of report functions.</p>
<p>There is another way that I can create a calculation; I can use the formula bar much like I can in a spreadsheet. Here I have activated the formula bar using the appropriate button and have clicked inside the edit area and started to create my formula.</p>
<p><img src="/tips/why_variables/formula_bar.png" width="592" height="200" border="2" alt="formula bar" title="Creating a formula with the formula bar in Web Intelligence" /></p>
<p>Is this a problem?</p>
<h3>Formula Challenges</h3>
<p>For this demonstration I have created the following simple formula.</p>
<p><code>=[Revenue] / 100</code></p>
<p>I can use this formula in a report block. In fact I can copy it to multiple report blocks. The problem is, after I have done this I have three (or more) different copies of the same formula. If I click on the initial cell where I created the formula and edit it (perhaps I meant to type 1000 instead of 100 earlier) then <strong>only that instance of the formula is changed</strong>. The rest of the formulas are stored elsewhere in the document and are not affected by the edit.</p>
<p>This is a problem.</p>
<h3>Converting a Formula to a Variable</h3>
<p>If I made this mistake and want to convert my wayward formula into a variable I can do that. There is a button on the formula toolbar here:</p>
<p><img src="/tips/why_variables/convert_to_variable.png" width="455" height="95" border="2" alt="toolbar button" title="Toolbar button to convert a formula to a variable in Web Intelligence" /></p>
<p>When I click that button I am presented with the following dialog box that allows me to assign a name to my formula. </p>
<p><img src="/tips/why_variables/name_variable.png" width="437" height="284" border="0" alt="Naming a variable" title="Naming a variable" /></p>
<p>Once a formula has a name it becomes a variable and shows up in the document data tab.</p>
<p><img src="/tips/why_variables/data_tab.png" width="209" height="198" border="2" alt="Data tab" title="Variables and objects in the data tab of a Web Intelligence report" /></p>
<h3>Summary</h3>
<p>This part of the presentation was probably considered to be fairly basic by most (if not all) of the folks in the room. However, I always repeat this same information every time I deliver a variables presentation. Why? Because of what happened years ago when I presented &#8220;Variables and More… Fourth Edition&#8221; at the conference in Las Vegas. I thought that by then everyone knew about the toolbar button that provided a way to convert a formula into a variable but it seems that was not the case. The very last question that I took from the audience was from a woman who wanted to know what to do with a formula she had created by mistake. I quickly created a formula and then showed how to convert it into a variable using the process I outlined here. I then found out just how many folks didn&#8217;t know about this technique, as it seemed the entire audience went &#8220;oooh, aaaah&#8221; and proceeded to give me the highest rated presentation marks that I have ever received. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_lol.gif' alt=':lol:' class='wp-smiley' /> </p>
<p>It just goes to show that anything and everything that you know is probably worth sharing. It is very likely that there is somebody, somewhere that doesn&#8217;t know what you consider to be basic information. Share those simple tricks and they are much better off. Plus you earn some good karma. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>So go ahead, answer a few questions on <a href="http://busobj.forumtopics.com">BOB</a>. Start a blog. Share what you know.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dagira.com/2009/11/03/constants-formulas-and-variables-oh-my/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Calculating Business Days Between Two Days Via Report Functions</title>
		<link>http://www.dagira.com/2009/10/23/calculating-business-days-between-two-days-via-report-functions/</link>
		<comments>http://www.dagira.com/2009/10/23/calculating-business-days-between-two-days-via-report-functions/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 00:57:50 +0000</pubDate>
		<dc:creator>Dave Rathbun</dc:creator>
				<category><![CDATA[2009 GBN - Dallas]]></category>
		<category><![CDATA[Report Techniques]]></category>
		<category><![CDATA[Variables!]]></category>
		<category><![CDATA[Web Intelligence]]></category>

		<guid isPermaLink="false">http://www.dagira.com/?p=160</guid>
		<description><![CDATA[A frequently asked question on BOB is:
How can I calculate the number of business days between two dates?
The easiest answer is to use a calendar table with a flag for business days because that takes care of everything quite easily. You can even mark holidays along with weekend days and make the results more useful.
But [...]]]></description>
			<content:encoded><![CDATA[<p>A frequently asked question on <a href="http://busobj.forumtopics.com">BOB</a> is:</p>
<blockquote><p>How can I calculate the number of business days between two dates?</p></blockquote>
<p>The easiest answer is to use a calendar table with a flag for business days because that takes care of everything quite easily. You can even mark holidays along with weekend days and make the results more useful.</p>
<p>But suppose you don&#8217;t have a calendar table. Suppose you don&#8217;t care about holidays, you simply want to count the number of Monday &#8211; Friday days between a range of dates. Can you do that?</p>
<p>The answer is coming if you read the rest of the post. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<p><em>Note: This technique was shown in public on Monday at the GBN conference. I had written this blog post some time ago but waited to release it until after the presentation had been delivered. The presentation has been uploaded to my blog and is available for download from the <a href="http://www.dagira.com/conference-presentations/">conference page</a>.</em></p>
<p><span id="more-160"></span></p>
<h3>Web Intelligence Functions Required</h3>
<p>This formula is going to use the following functions, so I will introduce and describe each of them a bit here.</p>
<ul>
<li><strong>DaysBetween()</strong><br />
Input values: two date values<br />
Output value: an integer number (no fractions) showing the number of days between the two dates</li>
<li><strong>DayNumberOfWeek()</strong><br />
Input value: date<br />
Output value: Number from 1 to 7 denoting the day of week (1 = Monday, 7 = Sunday)</li>
<li><strong>Truncate()</strong><br />
Input value: numeric expression or value, number of desired decimal places<br />
Output value: numeric value truncated to specified number of decimals, for example Truncate(3.14159, 2) = 3.14<br />
Truncate does not round, so Truncate(5.9; 0) returns 5 which is what is needed for this solution</li>
<li><strong>Mod()</strong><br />
Input value: two numbers<br />
Output value: the remainder of the first value divided by the second<br />
Example: Mod(10; 2) = 0 and Mod(11; 2) = 1 and Mod(15; 7) = 1</li>
<li><strong>Substr()</strong><br />
Input value: string, starting position, length<br />
Output value: part of the string<br />
Example: Substr(&#8217;1234&#8242;;2;1) = &#8216;2&#8242;</li>
<li><strong>ToNumber()</strong><br />
Input value: string representation of a valid number<br />
Output value: number<br />
Example: ToNumber(&#8217;2&#8242;) = 2</li>
</ul>
<h3>Counting Weeks</h3>
<p>One of the first steps in solving any sort of calculation is to look for shortcuts. Clearly there will be an infinite number of input values for my calculation so I need some way to avoid too many possible choices. Because of this I am going to start by counting the number of weeks between two days.</p>
<p>Take a look at the calendar on the right-side of my blog and try an experiment. It turns out that no matter which day of the week you start on, if you run for seven days you are guaranteed to get exactly two weekend dates. No more, no less, exactly two. Try it out and see. Start on a Sunday and count forward seven days and what do you get? Exactly one Sunday and one Saturday = two weekend days. Start on Monday and count forward seven days and the same thing happens. Start on Tuesday&#8230; on Friday, or even Saturday&#8230; and any range of seven days always has exactly two weekend dates included.</p>
<p>I can extend this to any multiple of seven days. If I have 14 days I get 4 weekend days. With 21 days I have 6 weekend days. If I multiply by five instead of two I get the number of weekdays in the range, therefore I am going to start my calculation using this pattern. Here is the start of the formula:</p>
<p><code>Truncate(DaysBetween([Start Date]; [End Date]) / 7 ; 0)</code></p>
<p>Let me break that down. First the <code>DaysBetween()</code> function is used to determine the number of days between the starting and ending dates for my range. Next I divide the number of days by seven which will result in a decimal result. For example, <code>15 / 7 = 2.14</code>. Finally I use the <code>Truncate()</code> function to remove the decimal, which converts 2.14 to 2. That gives me the number of full weeks between my two days. Here&#8217;s a table showing results for some sample day ranges.</p>
<table class="blogtable">
<tr>
<th>Number of Days</th>
<th>Number of Whole Weeks</th>
<tr class="alt">
<td class="code">3</td>
<td class="code">0</td>
</tr>
<tr>
<td class="code">5</td>
<td class="code">0</td>
</tr>
<tr class="alt">
<td class="code">7</td>
<td class="code">1</td>
</tr>
<tr>
<td class="code">8</td>
<td class="code">1</td>
</tr>
<tr class="alt">
<td class="code">13</td>
<td class="code">1</td>
</tr>
<tr>
<td class="code">14</td>
<td class="code">2</td>
</tr>
<tr class="alt">
<td class="code">15</td>
<td class="code">2</td>
</tr>
<tr>
<td class="code">20</td>
<td class="code">2</td>
</tr>
<tr class="alt">
<td class="code">21</td>
<td class="code">3</td>
</tr>
<tr>
<td class="code">22</td>
<td class="code">3</td>
</tr>
</table>
<p>Based on the conclusion I made earlier, I can use the number of weeks and multiply by five to get the number of week days included in the range. In order to get that number I make one small modification to the formula presented above; I multiply the result by five. The result:</p>
<p><code>Truncate(DaysBetween([Start Date]; [End Date]) / 7 ; 0) * 5</code></p>
<p>All I have left to deal with are the leftover of days that don&#8217;t make up a full week. The decimal part of 2.14 is 0.14 which represents one extra day in my range. In order to know whether to count that day or not, I have to know the <strong>name</strong> (or alternatively the number) of the day my range starts on.</p>
<h3>How Many Extra Days</h3>
<p>There is a function called <code>DayNumberOfWeek()</code>. It numbers Monday as 1 and Sunday as 7 so I&#8217;m going to pretend that my calendar looks like this:</p>
<p><code>M T W T F S S<br />
1 2 3 4 5 6 7</code></p>
<p>What I need to get next is the number of days that are <strong>not</strong> a full week. I used the <code>Truncate()</code> command earlier to get the number of full weeks. It removes the decimal part of the division result. What I need now is the decimal part, and the <code>Mod()</code> function can be used to get it. This function does a division and returns the remainder. The first argument will be the total number of days, and the second argument will be seven as there are seven days in a week. The result will be a number that ranges from zero (0) to six (6) because those are the only possible remainder values when dividing by sevent. </p>
<p>For example, <code>Mod(15; 7) = 1</code>. 15 / 7 is 2 with 1 left over, therefore 1 is the return value from the <code>Mod()</code> function. To apply that to my current problem: 15 days is made up of two full weeks and one extra day. Twenty days would be <code>Mod(20; 7)</code> which results in 6 remaining days. <code>Mod(21; 7)</code> is zero because there are exactly three weeks and no extra days.</p>
<p>Can I put these two pieces of information together? I can easily get the number of the day in the week, and I know how many extra days there are. I should be able to do some math&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dagira.com/2009/10/23/calculating-business-days-between-two-days-via-report-functions/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>2009 GBN Presentations Posted</title>
		<link>http://www.dagira.com/2009/10/22/2009-gbn-presentations-posted/</link>
		<comments>http://www.dagira.com/2009/10/22/2009-gbn-presentations-posted/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 12:24:45 +0000</pubDate>
		<dc:creator>Dave Rathbun</dc:creator>
				<category><![CDATA[2009 GBN - Dallas]]></category>
		<category><![CDATA[Report Techniques]]></category>
		<category><![CDATA[Variables!]]></category>

		<guid isPermaLink="false">http://www.dagira.com/?p=213</guid>
		<description><![CDATA[I have uploaded the latest pdf files for my presentations from the 2009 GBN conference. You can download them from my conference presentations page. I did two presentations this year.
Return of the Variables
Presentation Abstract
It’s time to pull out some variables again as we revisit a popular topic from past conferences. Report variables can provide a [...]]]></description>
			<content:encoded><![CDATA[<p>I have uploaded the latest pdf files for my presentations from the 2009 GBN conference. You can download them from my <a href="http://www.dagira.com/conference-presentations/">conference presentations page</a>. I did two presentations this year.</p>
<h3>Return of the Variables</h3>
<p>Presentation Abstract</p>
<blockquote><p>It’s time to pull out some variables again as we revisit a popular topic from past conferences. Report variables can provide a more creative, efficient, and effective means of completing the detailed analysis required for your reports. The focus of this presentation is building documents, using report functions, and reviewing variable tricks that can be used to solve reporting challenges. The presentation this year will focus primarily on the SAP BusinessObjects Web Intelligence product and include some of the newest features that have recently become available, but there will be some goodies for users of prior versions as well.</p></blockquote>
<h3>Universe Models for Recursive Data</h3>
<p>Presentation Abstract</p>
<blockquote><p>Recursive data can present a special challenge to SAP BusinessObjects developers because SQL is not natively able to process the relationships. This presentation will show several different methods for modeling recursive data along with the pros and cons of each. All of the methods shown have been used on real-world projects. Attendees will gain a better understanding of the complexities of dealing with inventory models, organizational hierarchies, and other types of recursive data.</p></blockquote>
<p>As time allows I will be adding detailed blog posts for each of these presentations. I am cheating a bit this year. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I have already written two blog posts that detail most of the &#8220;Variables&#8221; presentation:</p>
<ul>
<li><a href="http://www.dagira.com/2009/09/03/using-forcemerge-to-fix-unbalanced-data-providers/">Using ForceMerge() To Fix Unbalanced Data Providers</a><br />
This post covers slides 13 through 18 from &#8220;Return of the Variables&#8221; and was originally released here on my blog back in September.</li>
<li><a href="http://www.dagira.com/2009/10/23/calculating-business-days-between-two-days-via-report-functions/">Calculating Business Days Between Two Days Via Report Functions</a><br />
This post covers slides 19 through 33 of the same presentation and is already written. I need to make a few tweaks and will likely publish it on Friday. Until then the link above won&#8217;t seem to be valid, but it should work after the post is published.</li>
</ul>
<p>That leaves only the initial portion of the presentation to write up, and I hope to have it done fairly soon. The detailed posts for the Designer presentation will take a bit longer.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dagira.com/2009/10/22/2009-gbn-presentations-posted/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using ForceMerge() To Fix Unbalanced Data Providers</title>
		<link>http://www.dagira.com/2009/09/03/using-forcemerge-to-fix-unbalanced-data-providers/</link>
		<comments>http://www.dagira.com/2009/09/03/using-forcemerge-to-fix-unbalanced-data-providers/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 12:30:35 +0000</pubDate>
		<dc:creator>Dave Rathbun</dc:creator>
				<category><![CDATA[Full Client]]></category>
		<category><![CDATA[Report Techniques]]></category>
		<category><![CDATA[Variables!]]></category>
		<category><![CDATA[Web Intelligence]]></category>

		<guid isPermaLink="false">http://www.dagira.com/?p=62</guid>
		<description><![CDATA[I have discussed the MultiCube() function a number of times in my series of Variables presentations. In certain situations it allows you to fix measure objects when you have two (or more) unbalanced data providers in a full-client document. ForceMerge() is the equivalent for Web Intelligence.
So how do they work, exactly? What do I mean [...]]]></description>
			<content:encoded><![CDATA[<p>I have discussed the <code>MultiCube()</code> function a number of times in my series of Variables presentations. In certain situations it allows you to fix measure objects when you have two (or more) unbalanced data providers in a full-client document. <code>ForceMerge()</code> is the equivalent for Web Intelligence.</p>
<p>So how do they work, exactly? What do I mean by unbalanced data providers? How is it fixed with these functions? Are there any special conditions to be aware of?<span id="more-62"></span></p>
<h3>Merged Data Provider Review</h3>
<p>I recently published a blog post that described unbalanced data providers. If you want the full description, I have included a link at the end of this post. If you want the executive summary, here it is:</p>
<blockquote><p>When you have two (or more) data providers in the same document and want to merge the data, you have to link them using dimension objects. If you don&#8217;t have the same number of dimensions from each data provider, then they are unbalanced. That can cause issues.</p></blockquote>
<p>It took me twelve hundred words (and six pictures) to provide a detailed explanation in my earlier post. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_lol.gif' alt=':lol:' class='wp-smiley' />  In the sample report I used for that post I had one common dimension (Year) and one unique dimension from each side (Resort and Region). I showed how I could use Year with either measure since it was a shared (and linked) dimension.</p>
<p><img src="/tips/forcemerge/merged_block.jpg" width="325" height="121" border="0" alt="merged block image" title="Web Intelligence report with Merged Data" /></p>
<p>I also showed how (and explained why) trying to use the &#8220;extra&#8221; dimensions like Region or Resort caused problems. I don&#8217;t intend to repeat everything here; please use the link at the end of this post to read the prior post if you are unclear on anything so far.</p>
<h3>What About MultiCube()?</h3>
<p>One of the comments I got on that post suggested that <code>MultiCube()</code> could be used to fix the issue. My response was accurate as far as I was concerned, but later when I read it again I realized it could also be quite confusing. Here&#8217;s what I said:</p>
<blockquote><p>&#8230;the MultiCube() function will help if data providers are unbalanced “upwards” but not “downwards” &#8230;</p></blockquote>
<p>After reviewing my response, I realized that it was quite likely that I was the only person that understood what I meant by that statement. While at times I do enjoy talking with myself <img src='http://www.dagira.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  that&#8217;s not why I have this blog. So I am going to try to explain that a bit further.</p>
<p>The problem with trying to use <code>MultiCube()</code> or the Web Intelligence equivalent <code>ForceMerge()</code> to solve this specific case is that the data doesn&#8217;t support the solution. There is no hierarchy or relationship between Region and Resort. <em>(Yes, they are both related via links to the fact table but that&#8217;s not what I mean.)</em> Resort is a place. Region is an attribute of the customer. There is a many to many relationship between regions and resorts, and that sort of relationship is essentially worthless. If I can&#8217;t determine how to put things together, how are the numbers going to make sense? Neither of these functions can create a relationship from nothing.</p>
<p>Yet there are some cases where I can fix unbalanced data providers. I need to talk about the data first, then I need to create a new document with the proper structure in order to show how the <code>ForceMerge()</code> function works.</p>
<h3>Hierarchical Data</h3>
<p>Here is what I consider to be a really good example of why this is a problem. Most people think of time as a really clean hierarchy. On the surface the hierarchy is simple: Months go into quarters, and quarters go into years. Yet if I create a query with the Quarter and Revenue from the Island Resorts database here is what I get.</p>
<p><img src="/tips/forcemerge/quarter_sales.jpg" width="217" height="121" border="0" alt="Quarter sales image" title="Web Intelligence Report showing Quarter Revenues" /></p>
<p>Take a look at the data and tell me how you would break out the quarter data into different years. </p>
<p>Go ahead and think a bit, I can wait.</p>
<p>One-Mississippi.</p>
<p>Two-Mississippi.</p>
<p>You can&#8217;t do it, can you? <img src='http://www.dagira.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  You don&#8217;t have enough information. As defined, with the format &#8220;Q1&#8243; and &#8220;Q2&#8243; and so on, there is no indication as to which year the quarter revenues are coming from. You can&#8217;t &#8220;break down&#8221; the quarter by year with the information that you have. That is what I meant by data being unbalanced &#8220;downwards&#8221; in my comment on my prior post. I can&#8217;t break data down because the information simply isn&#8217;t there.</p>
<p>What I can do, however, is roll up or move &#8220;upwards&#8221; via a hierarchy. That&#8217;s where the <code>ForceMerge()</code> function comes into play.</p>
<h3>Introducing the ForceMerge() Function</h3>
<p>Here is what the help text says for the <code>ForceMerge()</code> function.</p>
<blockquote><p>Forces Web Intelligence to account for synchronized dimensions in measure calculations when the synchronized dimensions do not appear in the calculation context of the measure</p></blockquote>
<p>I will explain what this means, but first I am going to build my example. My document will have two data providers from the Island Resorts Marketing universe. My first data provider has dimension values Country and Resort and the Revenue measure. My second data provider has the dimension Resort and the measure Guests. I will link the two data providers by Resort as it is the only common dimension.</p>
<p>Data Provider 1<br />
<img src="/tips/forcemerge/dp01_objects.jpg" width="252" height="74" border="0" alt="First Data Provider Image" title="Web Intelligence Data Provider Defintion #1" /></p>
<p>Data Provider 2<br />
<img src="/tips/forcemerge/dp02_objects.jpg" width="205" height="67" border="0" alt="Second Data Provider Image" title="Web Intelligence Data Provider Defintion #2" /></p>
<p>Data Provider Results<br />
<img src="/tips/forcemerge/dp_results.jpg" width="565" height="97" border="0" alt="" title="Web Intelligence Query Results" /></p>
<p>Merged Dimensions<br />
<img src="/tips/forcemerge/merged_dimensions.jpg" width="183" height="168" border="0" alt="" title="Web Intelligence Document Structure" /></p>
<p>From this point I will create a merged block using all of the measures and both dimensions. Here are the results from that experiment.</p>
<p><img src="/tips/forcemerge/merged_working.jpg" width="433" height="97" border="0" alt="" title="Web Intelligence Document with working merged data" /></p>
<p>Everything is fine so far. The issue becomes evident when I remove the Resort object from the block. Remember that my two data providers are merged (synchronized) by Resort. When that object is no longer present in the block, the measures roll up. Revenue is still okay because the Country object was part of the query context of that data provider. The Guests measure fails because it is now being viewed out of context. <em>(At the risk of becoming tedious, I will point out one last time that this issue is covered in much more detail in the first post in this series.)</em></p>
<p><img src="/tips/forcemerge/merge_fail.jpg" width="325" height="73" border="0" alt="" title="Web Intelligence Document with invalid merged data due to unbalanced dimensions" /></p>
<p>I have created a problem. Next, I will explain how to fix it.</p>
<h3>ForceMerge() In Action</h3>
<p>All of the information I need is there in the document. It just does not show up in the block. Here once again is the help text for the <code>ForceMerge()</code> function:</p>
<blockquote><p>Forces Web Intelligence to account for synchronized dimensions in measure calculations when the synchronized dimensions do not appear in the calculation context of the measure</p></blockquote>
<p>Simply put, the function tells Web Intelligence to <strong>use all of the information from the cube, rather than being limited to what is shown in the block</strong>. I will create a new variable with this formula:</p>
<p><code>=ForceMerge([Number of guests])</code></p>
<p>I will replace my &#8220;broken&#8221; measure with my new variable and observe the results.</p>
<p><img src="/tips/forcemerge/merge_success.jpg" width="325" height="73" border="0" alt="" title="Web Intelligence Document success with ForceMerge function to fix unbalanced dimensions" /></p>
<p>I haven&#8217;t changed my dimension linking. I haven&#8217;t changed my data providers. I didn&#8217;t even change the block structure, other than to replace the broken measure with my corrected calculation. If you were looking for something more complex, I&#8217;m afraid that&#8217;s all there is. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  <strong>The complicated part is understanding just what the function does and when to use it, rather than how to use it.</strong> I am glad this function is now available in Web Intelligence starting with XI 3.x. In my opinion, it should have been there since merging data providers was an option.</p>
<h3>Summary</h3>
<p>The magic of the <code>ForceMerge()</code> function (or if using Desktop Intelligence the <code>MultiCube()</code> function) is that it changes the behavior of the report engine. Normally when dimension values are removed from a block they are taken out of context. By using one of these functions I can specify that linked dimensions still have to be considered by the measures even if those dimensions no longer appear in the block structure.</p>
<p>Even with this magic function in my arsenal, I cannot rely on it to fix every problem that I have. If the data can be &#8220;rolled up&#8221; by the calculation process then I am fine. If the data has to be &#8220;broken down&#8221; then I am in trouble, and these functions will not fix the issue. Each resort exists in exactly one country so I can move up the hierarchy from the resort link and the results are valid.</p>
<p><strong>Special Note</strong><br />
If there are smart measures in a universe, then <code>ForceMerge()</code> will not work. In order to calculate the results correctly, smart measures (using the &#8220;database delegated&#8221; projection function) need to have the block structure in place to define the query. According to the documentation, the <code>ForceMerge()</code> function will return a <code>#MULTIVALUE</code> error if used in this situation.</p>
<p><strong>Related Links</strong></p>
<ul>
<li>Blog Post: <a href="http://www.dagira.com/2009/08/25/what-are-unbalanced-data-providers-and-why-should-i-care/">What Are Unbalanced Data Providers&#8230; And Why Should I Care?</a></li>
<li>Blog Post: <a href="http://www.dagira.com/2008/11/10/designer-xi-3-new-feature-database-delegated-measures/">&#8220;Smart&#8221; aka Database Delegated Measures</a></li>
</ul>
<p><strong>What was that &#8220;Mississippi&#8221; thing earlier?</strong><br />
From <a href="http://en.wikipedia.org/wiki/Mississippi#Trivia_and_modern_culture_related">Wikipedia</a>:</p>
<blockquote><p>Children in the United States and Canada often count &#8216;One-Mississippi, two-Mississippi&#8217; during informal games such as hide and seek to approximate counting by seconds.</p></blockquote>
<p>So now you know. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.dagira.com/2009/09/03/using-forcemerge-to-fix-unbalanced-data-providers/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Variable Relative Block Positioning</title>
		<link>http://www.dagira.com/2007/09/16/variable-relative-block-positioning/</link>
		<comments>http://www.dagira.com/2007/09/16/variable-relative-block-positioning/#comments</comments>
		<pubDate>Mon, 17 Sep 2007 04:19:25 +0000</pubDate>
		<dc:creator>Dave Rathbun</dc:creator>
				<category><![CDATA[Full Client]]></category>
		<category><![CDATA[Report Techniques]]></category>
		<category><![CDATA[Variables!]]></category>

		<guid isPermaLink="false">http://www.dagira.com/2007/09/16/variable-relative-block-positioning/</guid>
		<description><![CDATA[The Challenge
Both Desktop Intelligence and Web Intelligence provide options to coordinate the placement of one block based on the size of another. This technique is used when you have more than one block on a page and you want the lower blocks to move up and down (or left and right) on the page based [...]]]></description>
			<content:encoded><![CDATA[<h3>The Challenge</h3>
<p>Both Desktop Intelligence and Web Intelligence provide options to coordinate the placement of one block based on the size of another. This technique is used when you have more than one block on a page and you want the lower blocks to move up and down (or left and right) on the page based on the volume of data shown in the &#8220;relative&#8221; block. This works quite well with two blocks as shown below.</p>
<p><img src="/tips/variable_relative_blocks/01_two_blocks.gif" width="212" height="126" border="0" alt="Sample two-block layout" title="Sample two-block layout" /></p>
<p>The block on the left in this case (the blue box) would be the anchor block. The block on the right (the red block) would float relative to the anchor block. I can accomplish this by right-clicking on the floating block and selecting Format Block. The Appearance tab includes the following settings that I can tweak:</p>
<p><img src="/tips/variable_relative_blocks/02_relative_blocks.gif" width="359" height="121" border="0" alt="Setting the floating attributes" title="Setting the attributes for the floating block" /></p>
<p>This technique works well for a chain of tables either horizontally or vertically. But what if I have the following scenario where I need to float blocks <strong>both</strong> horizontally and vertically?</p>
<p><img src="/tips/variable_relative_blocks/03_three_blocks.gif" width="212" height="267" border="0" alt="Sample three-block layout" title="Sample three-block layout with combined horizontal and vertical float requirements" /></p>
<p><span id="more-29"></span></p>
<p>The screen shots that will be included in this post are taking from Business Objects 6.5. The same concept should work in Web Intelligence as well, although I don&#8217;t at this time intend to post those instructions. If you don&#8217;t know how to simulate the &#8220;hide block&#8221; option in Web Intelligence you can review my prior post on <a href="http://www.dagira.com/2007/07/31/alerters-on-charts-part-ii/">Chart Alerters in Web Intelligence</a> to see how that could work. Now on with the show.</p>
<h3>The Setup</h3>
<p>I created a query with Year, City, Store Name, Lines, and Revenue from the eFashion universe. My requirement calls for a three-block layout with the top-left block being store revenues, the top-right block is annual revenues, and the lower chart block will show lines revenues in a bar chart. Either the store block or the annual sales block could grow vertically. My requirement also calls for a prompt on the state. My challenge will be to figure out how to make the chart shift up or down based on either of the two top blocks. There is no option to make one block relative to two other blocks, so I will have to be creative. I like challenges like this. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>Take Care of the Basics First</h3>
<p>The first step I take to solve this challenge is to give each of my blocks a descriptive name. Since the annual sales block is to the right of the store sales block I will let it float horizontally based on the width of the store block. That&#8217;s fairly straightforward. Here is what the data looks like when I refresh the report for Colorado:</p>
<p><img src="/tips/variable_relative_blocks/08_colorado_sales.gif" width="450" height="377" border="0" alt="Colorado Sales Results" title="Colorado Sales results" /></p>
<p>Everything looks fine. But when I select Texas for my second refresh notice the problem that I have:</p>
<p><img src="/tips/variable_relative_blocks/09_texas_sales.gif" width="450" height="369" border="0" alt="Texas Sales Results" title="Texas Sales results" /></p>
<p>I could solve this by making the chart block float relative to the store revenue block. But that won&#8217;t help if there is only one store that has ten years of sales. In that scenario the annual sales block will encroach on the lines chart just like the store sales block has done in this case. I need to make the chart block float relative to <strong>two blocks</strong> rather than just one.</p>
<h3>Variables to the Rescue</h3>
<p>The solution requires me to be able to tell which block has more data. In this simple scenario it will not be too hard. I have two blocks each with one dimension each. If I count how many dimension values there are and compare the two, I will be able to tell which block is going to be bigger. Here is the variable that I created, called Which Chart:</p>
<p><img src="/tips/variable_relative_blocks/10_flag_variable.gif" width="450" height="66" border="0" alt="Flag variable screen shot" title="Creating the flag variable" /></p>
<p>This flag returns two distinct values: Year Chart or Store Chart. The formula is structured in such a way that the flag returns the name of the chart that I want to hide. But wait a minute, I only have one chart, right? How does one chart end up with two names?</p>
<h3>Double Charts</h3>
<p>In my earlier post on Chart Alerters I showed how to create two duplicate charts, one green and one red, and then set up formulas to only show one or the other. I think I can use that trick again here. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  To solve this challenge I will create two charts. In this case the charts are identical other than their names. They even share the exact same location on the page, as shown here.</p>
<p><img src="/tips/variable_relative_blocks/17_overlay_charts.gif" width="450" height="189" border="0" alt="Overlay charts screen shot" title="Two charts that occupy the same space" /></p>
<p>By the way, the Structure Mode option from Business Objects really helps in completing this report.</p>
<p>The final steps are to float each chart relative to <strong>one</strong> of the two upper blocks, and then hide based on the variable that I created earlier. If the annual block has more rows than the store block, then the chart that floats relative to the store block needs to hide since it won&#8217;t move down far enough. If the store block has more rows then the chart related to the annual block needs to hide for the same reason. Here are the screen shots of those settings:</p>
<p><img src="/tips/variable_relative_blocks/15_hide_year_relative.gif" width="450" height="189" border="0" alt="Hide year block screen shot" title="Settings to show how to hide the chart floating relative to annual sales" /><br />
Notice that the float is relative to the Annual Sales block, and the hide formula is active if the chart to hide is the Year Chart.</p>
<p><img src="/tips/variable_relative_blocks/16_hide_store_relative.gif" width="450" height="189" border="0" alt="Hide store block screen shot" title="Settings to show how to hide the chart floating relative to store sales" /><br />
For the second chart the float is relative to the Store Revenue block, and the hide formula is active if the chart to hide is the Store Chart.</p>
<h3>Test the Results</h3>
<p>Once I finish creating my two charts, configure the relative float numbers, and create my hide conditions, how does it all look? The pictures tell the tale&#8230;</p>
<p><img src="/tips/variable_relative_blocks/20_colorado_works.gif" width="450" height="363" border="0" alt="Colorado working screen shot" title="Colorado report with longer annual sales block" /></p>
<p><img src="/tips/variable_relative_blocks/21_texas_works.gif" width="450" height="433" border="0" alt="Texas working screen shot" title="Texas report with longer store sales block" /></p>
<h3>Summary</h3>
<p>The purpose of this article was to show how to simulate the ability to float a block relative to two anchor blocks rather than just one. Since Business Objects does not provide this feature directly I used a variable, two charts, and a &#8220;hide block&#8221; setting instead.</p>
<h3>Associated Downloads</h3>
<ul>
<li><a href='http://www.dagira.com/wp-content/uploads/2007/08/variable-relative-block-positioning.zip' title='variable-relative-block-positioning.zip'>BusinessObjects 6.5 Sample</a><br />
This download was built using the eFashion sample database provided by Business Objects. It should be accessable to anyone using version 6.5 or higher. The source file is zipped so you will need an unzipping utility to extract the file.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.dagira.com/2007/09/16/variable-relative-block-positioning/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Alerters On Charts Part II</title>
		<link>http://www.dagira.com/2007/07/31/alerters-on-charts-part-ii/</link>
		<comments>http://www.dagira.com/2007/07/31/alerters-on-charts-part-ii/#comments</comments>
		<pubDate>Tue, 31 Jul 2007 18:16:34 +0000</pubDate>
		<dc:creator>Dave Rathbun</dc:creator>
				<category><![CDATA[Report Techniques]]></category>
		<category><![CDATA[Variables!]]></category>
		<category><![CDATA[Web Intelligence]]></category>

		<guid isPermaLink="false">http://www.dagira.com/2007/07/31/alerters-on-charts-part-ii/</guid>
		<description><![CDATA[The Challenge
In a previous post I showed a way to create the illusion of an alerter on a chart using the full client product. In this post I will reuse the same technique with a slight twist so that it works in Web Intelligence as well. If you have not already read Part I please [...]]]></description>
			<content:encoded><![CDATA[<h3>The Challenge</h3>
<p>In a previous post I showed a way to create the illusion of an alerter on a chart using the full client product. In this post I will reuse the same technique with a slight twist so that it works in Web Intelligence as well. If you have not already read <a href="http://www.dagira.com/2007/07/22/alerters-on-charts/">Part I</a> please do so first so you will be familiar with the basic steps for this technique. </p>
<p>Here is a summary of the steps that I used to solve this in Business Objects:</p>
<ul>
<li>Create two versions of the chart: one green and one red</li>
<li>Create a variable that shows the trend of the data</li>
<li>Use the Hide Block feature of Business Objects to keep one of the charts from being displayed</li>
<li>Position both charts in exactly the same space, providing the illusion that the chart is changing colors based on the data</li>
</ul>
<p>This is all fine&#8230; but Web Intelligence does not have the &#8220;hide block&#8221; feature. So how do I solve this issue?</p>
<p><span id="more-16"></span></p>
<h3>Solution using Web Intelligence XI Release 2</h3>
<p>I started out by creating the same query and the same page layout used in Part I. I ended up with two charts: one is green and one is red.</p>
<p><img src="/tips/alerters_on_charts_part_2/001_dual_charts.gif" width="450" height="203" border="2" alt="Dual charts" title="Showing two charts in Web Intelligence for Alerts on Charts" /></p>
<p>Since Web Intelligence does not provide a &#8220;hide block&#8221; feature I had to find something different. I experimented with different things and found that the following technique seemed to work. Instead of whining about the lack of the &#8220;hide block&#8221; feature <img src='http://www.dagira.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  I used a standard block filter instead. First I created the formula (which has a slightly different syntax in Web Intelligence) as follows:</p>
<p><code>=Sign([Sales revenue] Where([Year]="2003") - [Sales revenue] Where([Year]="2001"))</code></p>
<p>After creating that variable I created a block filter as shown here:</p>
<p><img src="/tips/alerters_on_charts_part_2/002_filter_block.gif" width="328" height="373" border="2" alt="Block Filter" title="Block filter in Web Intelligence for Alerts on Charts" /></p>
<p>The filter is designed to create an empty block. However, the default behavior in Web Intelligence is to continue to show a block even if it is empty. This can easily be changed using the proper block attribute as shown here:</p>
<p><img src="/tips/alerters_on_charts_part_2/003_show_when_empty.gif" width="279" height="318" border="2" alt="Show block when empty" title="Show block when empty setting in Web Intelligence for Alerts on Charts" /></p>
<p>By clearing this checkbox the empty block will not be displayed at all. This is how I can recreate the &#8220;hide block&#8221; option available in the full client products. The rest of the trick follows the same steps that I used in Business Objects. I use the block positioning options (found on the Page Layout properties) as shown here:</p>
<p><img src="/tips/alerters_on_charts_part_2/004_chart_position.gif" width="272" height="170" border="2" alt="Block position settings" title="Block position settings in Web Intelligence for Alerts on Charts" /></p>
<p>I set both the green chart and the red chart to exactly the same size and position, apply the changes, and review the results:</p>
<p><img src="/tips/alerters_on_charts_part_2/005_final.gif" width="306" height="521" border="2" alt="Final results" title="Final results in Web Intelligence for Alerts on Charts" /></p>
<h3>Summary</h3>
<p>If you need to create an alerter on a line chart I have now shown techniques that can be used to solve that challenge in both Business Objects and Web Intelligence. Both techniques involve using two charts, a very simple variable, and then a platform-specific technique to hide a block.</p>
<h3>Functions Used</h3>
<ul>
<li>Sign()</li>
</ul>
<h3>Related Posts</h3>
<ul>
<li><a href="http://www.dagira.com/2007/07/22/alerters-on-charts/">Alerters On Charts: Part I</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.dagira.com/2007/07/31/alerters-on-charts-part-ii/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Alerters on Charts: Part I</title>
		<link>http://www.dagira.com/2007/07/22/alerters-on-charts/</link>
		<comments>http://www.dagira.com/2007/07/22/alerters-on-charts/#comments</comments>
		<pubDate>Sun, 22 Jul 2007 17:28:14 +0000</pubDate>
		<dc:creator>Dave Rathbun</dc:creator>
				<category><![CDATA[Full Client]]></category>
		<category><![CDATA[Report Techniques]]></category>
		<category><![CDATA[Variables!]]></category>

		<guid isPermaLink="false">http://www.dagira.com/2007/07/22/alerters-on-charts/</guid>
		<description><![CDATA[The Challenge
Officially there is no way to put an alerter on a chart. Yet some time back I was challenged by a client to create a line chart that was green if the overall trend was up, and red if the overall trend was down. This chart appeared in a sectioned report so there was [...]]]></description>
			<content:encoded><![CDATA[<h3>The Challenge</h3>
<p>Officially there is no way to put an alerter on a chart. Yet some time back I was challenged by a client to create a line chart that was green if the overall trend was up, and red if the overall trend was down. This chart appeared in a sectioned report so there was a different chart for each section value. Possible? It turns out that there was an answer that works. With minor changes it works in both the desktop and the web products as well.</p>
<p>The eFashion database and universe are used in this demonstration.</p>
<p><span id="more-15"></span></p>
<h3>Solution using Business Objects 6.5</h3>
<p>The first step is to get some data that will support this requirement. I selected the Lines objects from the Product class, the Year from the Time class, and the Sales revenue from the Measures class. Depending on your version of eFashion data you might have slightly different values but the 6.5 version of the database looks like this:</p>
<p><img src="/tips/alerters_on_charts/001_data.gif" width="321" height="201" border="2" alt="Raw data" title="Raw data for Alerters on Charts" /></p>
<p>As you can see from reviewing the data the Accessories product line is in an overall downward trend if you take the first and last year as the only data points. City Skirts is in an upward trent, and City Trousers is again in a downward trend. I don&#8217;t intend to do a true trend analysis with moving averages; I am going to make a very simple definition of &#8220;up&#8221; or &#8220;down&#8221; and use the first year and last year as my only two data points for this tip.</p>
<p>The next step is to create a variable that determines the trend direction. I am going to need a variable because that&#8217;s how I can determine which chart to show later on. The variable is hard-coded in this sample since I know what the end points are. The formula for the variable looks like this:</p>
<p><code>=Sign(&lt;Sales revenue&gt; Where (&lt;Year&gt;="2003") - &lt;Sales revenue&gt; Where (&lt;Year&gt;="2001"))</code></p>
<p>There are two components to this formula. The first is the &#8220;Where&#8221; clause on the measure value. This applies a filter to the revenue so that the value for the measure is filtered to a specified year rather than showing a total. The second component is the <span class="function-name">Sign()</span> function. The <span class="function-name">Sign()</span> function is fairly simple: it returns the numeric sign of the argument. If the argument is any positive value, no matter how big or small, the sign is +1. If the numeric argument is negative, the sign is -1. If the number is zero the sign is zero, and finally if the number is undefined the sign is also undefined.</p>
<p>The results of this formula are shown here:</p>
<p><img src="/tips/alerters_on_charts/002_trend.gif" width="214" height="261" border="2" alt="Trend data" title="Trend data from formula for Alerters on Charts" /></p>
<p>Notice that each product line has an appropriate trend, based on the difference in the 2003 revenues and those for 2001? I will be using this again shortly.</p>
<p>The next step is to set up the chart. For this example I am going to use a simple line chart as it shows the trend in the most obvious fashion. First I created a section on Lines, and then a line chart with Sales revenue and the Year data. Here&#8217;s what the first version of the chart looked like, and I&#8217;m not entirely happy with the results:</p>
<p><img src="/tips/alerters_on_charts/003_basic_chart.gif" width="262" height="611" border="2" alt="First chart" title="First chart for Alerters on Charts" /></p>
<p>What don&#8217;t I like? Because of the difference in scale I can barely see the second chart as it is using the same scale as the first chart. Here is what I would rather see:</p>
<p><img src="/tips/alerters_on_charts/004_adjusted_chart.gif" width="264" height="605" border="2" alt="First chart" title="First chart for Alerters on Charts" /></p>
<p>What I have done here is activate a setting that tells the report to use the scale within each section rather than for the overall report. I think it&#8217;s going to be much easier to read. Here&#8217;s where that setting appears:</p>
<p><img src="/tips/alerters_on_charts/005_adjust_chart_scale.gif" width="450" height="356" border="0" alt="Adjust chart scale" title="Adjust chart scale per section for Alerters on Charts" /></p>
<p>I now have a chart that I like, but it doesn&#8217;t fit the requirement yet. All of the charts are green, even those that are in a downward trend. The next few steps will complete this tip and solve the problem. First, I will duplicate the chart so that I have two identical charts. I will then change the color on the second chart so that it is red. (At the same time I increased the weight of the line just to make the charts more visible.) Here&#8217;s where these steps leave me:</p>
<p><img src="/tips/alerters_on_charts/006_dual_charts.gif" width="450" height="509" border="2" alt="Dual charts" title="Dual charts one green and one red for Alerters on Charts" /></p>
<p>The final step is to ensure that only one of these two charts appears for each section. This is done by right-clicking on the chart, selecting Format Chart, and going to the Appearance tab of this dialog box. I started on the red chart and entered a &#8220;Hide&#8221; formula that looks like this:</p>
<p><code>=&lt;Sales Trend&gt; = 1</code></p>
<p>For the green chart I do something similar but use this formula instead:</p>
<p><code>=&lt;Sales Trend&gt; &lt;&gt; 1</code></p>
<p>Here&#8217;s the screen where this is done:</p>
<p><img src="/tips/alerters_on_charts/007_hide_chart.gif" width="450" height="356" border="0" alt="Hide Chart Feature" title="Hide Chart Feature used on Alerters on Charts" /></p>
<p>What does this do? If the trend is positive then the red chart is hidden. If the sales trend is negative or zero then the green chart is hidden. So I get something like this:</p>
<p><img src="/tips/alerters_on_charts/008_hidden_charts.gif" width="450" height="505" border="2" alt="Hidden Charts" title="Hidden charts used for Alerters on Charts" /></p>
<p>I&#8217;m almost to the end of the technique&#8230; the last step is to carefully size and position the two charts so that they occupy the same space. Since I know only one or the other will ever be displayed I want them to be in exactly the same space. This provides the illusion that there is a chart alerter that is changing the color of the chart based on the trend of the sales data. The reality is there are two charts that switch places. Here is the final output:</p>
<p><img src="/tips/alerters_on_charts/009_final.gif" width="266" height="584" border="2" alt="Final Charts" title="Final result for Alerters on Charts" /></p>
<p>Part II of this article will continue this idea and show how to accomplish the same illusion using techniques available in Web Intelligence.</p>
<h3>Summary</h3>
<p>The purpose of this article was to show how to simulate the appearance of a chart alerter. Since the tools do not provide this feature directly I used a variable and the &#8220;hide block&#8221; feature instead.</p>
<h3>Functions Used</h3>
<ul>
<li>Sign()</li>
</ul>
<h3>Associated Downloads</h3>
<ul>
<li><a href='http://www.dagira.com/wp-content/uploads/2007/08/alerters-on-charts.zip' title='alerters-on-charts.zip'>BusinessObjects 6.5 Sample</a><br />
This download was built using the eFashion sample database provided by Business Objects. It should be accessable to anyone using version 6.5 or higher. The source file is zipped so you will need an unzipping utility to extract the file.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.dagira.com/2007/07/22/alerters-on-charts/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Variables and More Variables</title>
		<link>http://www.dagira.com/2007/07/10/variables-and-more-variables/</link>
		<comments>http://www.dagira.com/2007/07/10/variables-and-more-variables/#comments</comments>
		<pubDate>Wed, 11 Jul 2007 04:44:53 +0000</pubDate>
		<dc:creator>Dave Rathbun</dc:creator>
				<category><![CDATA[Variables!]]></category>

		<guid isPermaLink="false">http://www.dagira.com/2007/07/10/variables-and-more-variables/</guid>
		<description><![CDATA[If you have been to the Integra Solutions web site and looked at their presentations page, or if you have been to one of the many Business Objects conferences that I have presented at over the years, you may have seen one of my &#8220;Variables&#8221; presentations. The very first one was in 1997 at the [...]]]></description>
			<content:encoded><![CDATA[<p>If you have been to the Integra Solutions web site and looked at their presentations page, or if you have been to one of the many Business Objects conferences that I have presented at over the years, you may have seen one of my &#8220;Variables&#8221; presentations. The very first one was in 1997 at the conference in New Orleans. And believe it or not, it was the presentation that almost wasn&#8217;t. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><span id="more-13"></span></p>
<p>I joined Integra Solutions in 1995 and got to go to my very first Business Objects conference that year. In 1996 I got accepted as a presenter for the very first time. That presentation was really not very good. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  It was also for version 4.0, which was a rather uninspiring release for Business Objects. I think they had monthly patches for about half a year until they got to something relatively stable. I remember getting to what we jokingly called the &#8220;Canadian Version&#8221; which was 4.0.5.6a before we got something that was usable. (Say the version out loud and you&#8217;ll understand why we called it the Canadian version&#8230; <img src='http://www.dagira.com/wp-includes/images/smilies/icon_lol.gif' alt=':lol:' class='wp-smiley' />  ) But I digress.</p>
<p>As I said, that presentation was not very good. There were other Integra presentations that were quite good that year, it was just mine that was bad. But the following year (1997) we were not selected for a single presentation. Not one. As a very small company the conference was really our one chance to do any large-scale marketing, so we were quite disappointed. As luck would have it, a few weeks later I was at a client site where a couple of Business Objects folks were visiting as well. During a conversation during a break in the work it came out that one of the gentlemen was part of the selection process. So I whined. Politely, I think, but it was whining. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  I did tell him that if they had any cancellations and needed someone to fill in a spot at the last moment, we were more than willing to help out.</p>
<p>Fast forward for a few months. At this point the conference is only about six weeks away, and we get a call asking if we take one of our abstracts and get ready to do a presentation at the conference. The abstract that was selected? &#8220;Variables and More Variables&#8221;</p>
<p>That conference was a lot of fun for me. First of all, I got to do what I thought was a really fun presentation. Second, it was in New Orleans, which was near where I grew up and went to college. I got to see a lot of old friends&#8230; one of whom was actually attending the conference and using Business Objects in her work! Third, it was the beginning of what became a regular occurrence for me. Over the following years I did five more presentations on reporting techniques, all named &#8220;Variables&#8221; in some form or another. At a conference a few years ago (held here in my current home-base of Dallas) I did &#8220;Variables Greatest Hits&#8221; which was fun too. In that presentation I took some of my favorite techniques from over the years and converted them all to work in Web Intelligence. Since version 6 had just been released (and finally included variables in the web product) it seemed to be a good opportunity.</p>
<p>Ultimately that made seven different conferences that I got to attend because of a chance encounter with a Business Objects employee at a client site. Maybe if I had not whined about the lack of selections, the &#8220;Variables&#8221; series never would have happened. The rest, as they say, is history. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> </p>
<p><em>Author note: I plan to revisit and expand on many of the tricks included in those presentations in some of my future blog posts. I hope you will find them useful.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dagira.com/2007/07/10/variables-and-more-variables/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
