You are on page 1of 17

Waterfall Charts in Webi

Although waterfall charts are not an option in Webi, with a little trickery it's possible to create something that looks and behaves as a waterfall chart should. I’m Using
• •

BOBJ XI3.1 SP3 InfoView/Webi

I’m Assuming

You know your way around Webi

Here’s the end result:

My data set is quite simple. It’s the change in employee numbers for the twelve months of the year. Each number represents a difference (from the previous month), not a discrete number. If you’re charting financial data (a P&L, for example) you’ll also probably be dealing with both positive and negative values, so the logic will be the same.

For Webi though. or somewhere in the middle). there would only be one series. you’ll need five series. Here they are in detail… Position First. The formula looks like this: =If [Month] = Min([Month]) In Report Then "First" ElseIf [Month] = Max([Month]) In Report Then "Last" Else "Middle" and the result looks like this: . we need to work out what the ‘position’ of the member in the data set (is it the first month. you probably want to colour your bars depending on their value. in the chart. and position. This is what the White Space series is about. They’re all variables based on the same measure: • • • • • First Up Down Last White Space The reason for all these measures is twofold. For this I’ll use a formula variable that checks to see if the value of ‘month’ is the smallest or largest (since dates can be treated as numbers). Secondly.If this were a real waterfall chart. the last month. you need to have the bars appearing to ‘float’. Firstly.

if the month is not the first or last. E. That is. . so would use these in the formula instead.: =If [Metric] = “Revenue” Then "First" ElseIf [Metric] = “Total” Then "Last" Else "Middle" Value (First) This one is easy: =If [Position] = "First" Then [Value] Value (Last) Not quite as easy. The formula is: =If [Position] = "Last" Then Sum([Value] ForAll([Month])) Value (Up) =If [Position] = "Middle" And [Value] > 0 Then [Value] That is.If you were charting a P&L. it should be represented by this variable.g. I’ve chosen to display my waterfall chart with a ‘total’ style bar at the end. it clearly shows what the number of employees at the end of the year is. and the value is positive. you would most likely know the value of the first and last metric.

Then we draw the negative value (as a positive number) ‘on top of’ the white space. by the value of the bar. Since each bar must start where the previous bar stopped. and if the value is positive. except that we’ll turn the negative value into a positive. But if the value is negative. we need to reduce the white space below the bar. then we simply start there and draw the next bar upwards. Start Point This is an interim variable (referred to by the ‘White Space’ variable).Value (Down) =If [Position] = "Middle" And [Value] < 0 Then Abs([Value]) This is the same logic as Value (Up).[Value] White Space Now we will take the Start Point variable above. It represents the start point of each bar in the chart. there’s no such thing as ‘drawing a bar downwards’. The formula itself is pretty simple. For negative values. =RunningSum([Value]) . =If [Position] = "Middle" Then [Start Point] + If [Value] < 0 Then [Value] The Result . we will use the variable to ‘store’ that last value.

it’s the running total. The Chart First I’ll get rid of the Value column. do the following: . In the properties for the chart. since these are never actually used in the chart. since the value is negative).I’ve greyed out the original values. You can see that the White Space variable is an offset running total. then right click the block and select Turn To. then select a vertical stacked bar chart. minus the value (actually. This gives a rather awful looking chart. In that case. plus the value. until we get to a negative value (June).

. click the ellipsis to the right of the palette colours. Change each of the first five colours to whatever you like. 9. For me: White Space. Click Edit Palette… near the bottom of the window that appears. Up. Remember that this depends on the left-to-right order of your variables in the block you started with. you should be getting a good picture of what’s going on: 7.1. Set the Data > Border Color to None. 2. 11. Click on the first (top left) colour. So my colours look like this: At this point. Un-tick Display > 3D Look Under Data. Set the data values font to white. 12. Turn off the X Axis label border. Down. 10. 4. 5. Turn off the X Axis value border. 6. Last. 3. 8. Tick Data > Values > Show data. Set this to white. First. Set the Appearance > Wall Color to white.

Save the file as VisualizationConfig. And since here you want to change the first colour to white. And that’s it. But here's how: 1. Remove the border for the Y Axis label. this may not be the sort of thing that you want to apply across your organisation. This unfortunately cannot be avoided. you'll need to modify an XML file on the server. Under Y Axis > Label type the name of your value into the Other label field (e. Unfortunately.xml 3. Save the file. Turn off the Y Axis grid. The font must be the same colour as the background. The more sophisticated features of a waterfall chart like dotted lines and interim numbers can’t be replicated in the chart. Mmm yyyy) 14. Crystal Enterprise and Analysis. since the ‘white space’ series actually has values as well. Open C:\Program Files (x86)\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4. you now have a real fake waterfall chart! Limitations • • • • You will have noticed above that we had to turn off the horizontal lines. Set the X Axis values Number Format where appropriate (e. setting the colours for the bars is not a trivial thing. 17. Edit the colours as you please. which will affect charting for Webi.0.g.xml 2. 4. 5.) .0\images\VisualizationConfig. Remove the border for the Y Axis. 15. if you're using BI4.13.g.template. Employees) 16. (Thanks to Pieter Verstraeten for the instructions. Restart Tomcat.

February. If you don’t have a month name dimension. My report block doesn’t sort properly. 1. click on Custom Sort… in the sorting drop-down on the toolbar. with the editing mode set to advanced (Preferences > Web Intelligence). Drag the Month Name dimension onto the page (hold down alt before before dragging if you have other blocks on the page and don’t want to create a section). August. Us humans believe that months are sorted January. If you have access to modify your universe or even data source. The following steps and screenshots were carried out in XI3. My chart doesn’t sort properly. in Webi can often seem quite difficult. Webi via InfoView. 2. December… If you’re here reading this. 3.Sorting Months in Webi Sorting dates. you will find that the months sort like this: To sort the months correctly. you may have one of these problems: 1. March and so on. and particularly months. follow these steps. With the block selected. .1 SP3. use this formula to create a variable (I’ll use the phrases ‘variable’ and ‘dimension’ interchangeably): =Month([Order Date]) 2. Machines will tell you that months are sorted April. skip right to the bottom… Sorting Months in a Filter Drop-down If you want your users to be able to select a month in a simple filter. My drop-down list of months doesn’t sort properly.

open it again. in date format. one average option. . Click OK. 5. You will now have a nicely-sorting drop-down. 6. Not great. Webi will remember the custom sort. one bad option. but means that you need to be re-defining the custom sort order as the months roll by. It will look fine to your users. and the one I use. you have one pretty bad option.3. The second option is to set up a custom sort for a year/month dimension. close it. or however they are ordered where you come from: 4. Sort the months like so. Save your report. • The worst one looks like this: • It’s just a list of months. But what if you want to show the month and year in the drop-down? Well. You can delete the block if you don’t need to use it in your report layout.

Last. my preferred approach is to simply have one drop-down for year and another for month. • The Month Year dimension. you may want to increase the number of allowed items in a custom sort: CMC > Servers > WebIntelligenceProcessingServer > Properties > Maximum Custom Sort Size (entries). "0000") . Use this formula… =Month([Order Date]) + " " + FormatNumber(Year([Order Date]).• If you like this option. but it doesn’t look pretty. one for the humans and one for the machine. like so: • It does the job. Option three is to format your dimension in such a way that the machine sorts the records in the same way us humans want to see them. Next… Sorting Months in a Report Block Obviously you already know how to sort a list of months using a custom sort. but what if you want to show the year and month in the one column? First you’ll need two dimensions.

and apply a format if it is. 4. "00") …for a dimension that looks like this: The idea is quite simple. you’d like your report to sort by the Year Month Code dimension. But it can apply more than just formats… 3. but display the Month Year dimension to the user. . 1. using the Year Month Code dimension. If you’re not familiar with alerters. Name the alerter something useful. Click New.…for a dimensions that looks like this: • The Year Month Code dimension. If it’s the first column. the short version is: an alerter will check to see if some condition is true. Start by creating your report block. Use this formula… =FormatNumber(Year([Order Date]). With the Year Month Code column selected. 2. you won’t even need to define any sorting. "0000") + " " + FormatNumber(MonthNumberOfYear([Order Date]). click Alerters in the toolbar.

like Year Month Code = Year Month Code. or whatever is appropriate.5. and click Select and object or variable. 13. 10. Click Format… 7. 12. The result should look like this: 6. And you’re done! . Click OK. To do this. Click OK. 8. Click OK. 11. Click the formula icon in the top left. Create a condition that is always true. click the ellipsis next to boxes on either side of the operator. The formula should simply point to your Month Year dimension. Set the font to black. 9.

Set the display formula to show the friendly name for your month and year. Month and Date. Set the first sub-alerter to When Cell Contents is equal to Quarter Name where ‘Quarter Name’ is the quarter dimension in your hierarchy (don’t just type the words ‘Quarter Name’). 9. rather than just the month. With the year column selected. 5. Click format… 6. but for Quarter and Month.And now for a little tweak so that you can still use this even when drilling down through a hierarchy. 3. give it a name. Year and date look fine just the way they are. like the . The column will change to display the month dimension. which will show the month name and year. Drill again and the date dimension will show. when you drill down from year. I have four dimensions in my date hierarchy: Year. Drill again. rather than just the quarter. I’d also like to display the year. so I’ll go quickly… 1. 8. click Alerters in the toolbar. Set the display formula to something like this (or create a variable that does the same): 7. Create a report block with a year column. 2. Add another sub-alerter and set it to When Cell Contents is equal to Month Number where ‘Month Number’ is the month dimension in your hierarchy. Quarter. and it will display the quarter name and year. This doesn’t need an alerter because. Add a new alerter. The logic is mostly the same as the above. the first column will change from showing the year dimension to show the quarter dimension. 4. The screen should look something like this: So now. This will trigger the first sub-alerter. which will trigger the second sub-alerter.

you selected the month column in order to apply the alerter that would display the nicely formatted date. If you do have access to modify your data source/universe.OrderDate DAY(Sales. Switch back to View Results and you’ll see that the chart now displays the month name and year. Oracle. For a chart you must first select View Structure.SalesOrderHeader. BEx Query or anything else.SalesOrderHeader. This means it makes no difference if you data source is MS SQL. I’ve changed the definition of my Month Year variable to show shortened month and year values. Sorting the Months in a Chart It’s more of the same right here. then it helps to add in a dimension that will truncate a date to the first day of the month. Then apply the alerter.year dimension. In the steps above. One Level Down All of the above are things that you can do in Webi. The steps are the same as they are for a block. it looks and sorts correctly as it is. with one twist. Select the Year Month Code dimension.OrderDate) + 1 . In T-SQL: Sales.

format this as MMMM YYYY or however you like. Moving Average in Webi A moving average is a nice way of smoothing out noisy data.RunningSum(Previous([Revenue]. 5)) .OrderDate. with the exception of a drop-down filter. The variable to return the running sum from five rows prior is: =RunningSum(Previous([Revenue]. In this case [Revenue]. So for any month. you need a running sum of the measure that you want to moving average for. =RunningSum([Revenue]) But the number gets bigger and bigger. 5))) / 5 The Logic First. this will look and sort correctly. MONTH) In Universe designer. Then.SalesOrderHeader. I’ve seen the requirement a few times so here we go… =(RunningSum([Revenue]) . you actually want to subtract the running sum from five months ago. and you only want to look at the last 5 rows of data. giving a clearer indication of how something’s trending over time. and I’m looking at the data monthly.In PL SQL: TRUNC(Sales.

=RunningCount([Month Year]) This works fine if you’re filtering directly on the block that has [Month Year] in it. you have the average of the last five rows of data. you’re missing out. So that’s it.Note that it’s just the same as the running sum value. even when the formula isn’t in a block. The first four rows are wrong. A moving average of 5 only makes sense from the fifth piece of data onwards. If you take the difference of the two. But lets make it robust and create a variable “RunningCount” with the formula: =RunningCount([Month Year]) In ([Month Year]) …so that Webi knows how to count the rows. But obviously not. A formula like this will give each row a count. you have a sum of the last 5 rows of data. but offset by 5 rows. Now create a report filter like so: . So you’ll probably want to filter out the first four rows. If you’re not familiar with input and output contexts. If you divide that by 5.

RunningSum(Previous([Revenue]. 5))) / 5) The finished result looks like this: Or in chart form (Blue is revenue. you still need to take into account the first four rows that you’ve filtered out! So go back to your moving average formula and wrap it in a NOFILTER(). =NoFilter((RunningSum([Revenue]) . .But remember. Orange is the moving average).