How can I split my measure into different columns by month in Business Objects WebI? - business-objects

This task is to be completed using SAP Business Objects WebI 4.2.
I have a table in the following format:
Company Date Amount
A 1/1/2014 100
A 16/2/2014 400
I have a variable called Month that has the Month for each transaction.
I want the table to look like:
Company January February
A 100 400
How can this be done without making a calculated field for each month?

In Webi you can't easily place a distinct category (Company) next to the values of another category (Month) in the same header row. So you have two options:
1) Create a regular horizontal table with three columns: Company, Month, & Value
2) Create a crosstab table with the Company on the left/vertical axis and the Month on the top/horizontal axis. Your values would be in the middle.
Note: if you wanted to do a lot of manual coding, you could set it up the way you want. The first column would hold your Company variable. The next column, "January" would require a formula:
=if([Month]=January) Then [Value]
You'd then have to create 11 more columns, with variables for each:
=if([Month]=February) Then [Value]
=if([Month]=March) Then [Value]
=if([Month]=April) Then [Value]
etc...
It would be tedious to do, and personally I'd go for one of the first two options. But it would work!

Related

SSRS Report - Badges

Is there an easy way to do a page of badges in an SSRS report? I am looking at 2 across and 3 down per page based on a list. I have built one so far of a single column using a list box but the problem is that it is not advancing to the next record and shows me the same record over and over until I get to the end of the count of total records in the dataset so I know I am doing something wrong. I am using Visual Studio 2017
I use a matrix when I am making a grid with boxes that go across and down.
First I add a ROW_NUMBER to the query to have the order in which to show the records. I subtract 1 so the values start with 0.
SELECT *, ROW_NUMBER()OVER(ORDER BY EFF_DATE) - 1 ROW_NUM
FROM BLAH_BLAH...
Then in SSRS, add 2 Calculated Fields to the dataset with the ROW_NUM.
The first is named ROW. It will have an integer with the row that the record will end up in.
=INT(Fields!ROW_NUM.Value / 2)
The second is COLUMN that will give the a column number.
=Fields!ROW_NUM.Value MOD 2
Then in the matrix, set the grouping based on the calculated fields.
COLUMN GROUP
Group and Sort by COLUMN
ROW GROUP
Group and Sort by ROW
The 2 can be changed to use whatever number of columns is needed.

How do I create a single bar chart from three independent data sources?

Input
I have three datasets (simplified example below):
List of students from school A and their age (1200 records)
List of students from school B and their age (200 records)
List of students from school C and their age (2000 records)
Every dataset has two columns: studentId and age.
Desired result
I want to create a bar chart that shows the distribution of age across these schools. For easy comparison I would like to have:
one bar chart
with three legend entries:
A
B
C
7 categories:
age =< 12
age = 13
...
age >= 18
What I have tried
I tried linking the datasets, but due to the different number of students and the various studentId formats per school this did not work.
I tried using the studentId columns of the three datasets as the value and the age column of every dataset as the axis. This only worked one dataset at a time. I needed to "Go to the next level in the hierarchy" to see the other dataset.
How else can I achieve this?
You can go into Power Query Editor:
And you will need to add a new column for each datasheet with the legend you want, for example:
So your tables should look like this:
Then merge the tables with Append Queries as New:
Select Three or more tables, and add the three tables:
And there you have your three tables merged into one.

How to Combine Fields from Two Datasets SSRS?

I am working on a report to show the total number of hours an employee spent working. Our company tracks labor hours by Service Request and Work Order so I need to bring totals for each into the report.
I created two datasets- one for Work Orders and one for Service Requests. Ideally, I would like to combine the total number of Work Order hours with the total number of Service Request hours and present that number listed by employeeID since both datasets have the employeeID field.
I thought it would be as simple as:
=(SUM(Fields!TOTALHOURS_WO.Value, "DataSet1") + SUM(Fields!TOTALHOURS_SR.Value, "DataSet2"))
I don't get an error, however, I am getting a number which repeats for each employee so I know I'm doing something wrong.
Any help is greatly appreciated.
Mal,
As #StevenWhite mentioned, LOOKUP is probably the function you are looking for.
Here is an example for you. For the example datasets:
EmployeeID | TOTALHOURS_WO
-----------------------------------
123 | 12
456 | 3
EmployeeNum| TOTALHOURS_SR
-----------------------------------
123 | 2
456 | 5
You will note that each table in a SSRS report needs a DataSet assigned to it. I will assume your table is using our first DataSet, which we will name "DataSet1". The second dataset above will be "DataSet2".
For your total hours you will use an expression. It should look something like this:
=TOTALHOURS_WO + LOOKUP(Fields!EmployeeID.Value, Fields!EmployeeNum.Value, Fields!TOTALHOURS_SR.Value, "DataSet2")
So you will be adding the TOTALHOURS_WO from your local dataset to the result from the LOOKUP function. What lookup is doing is taking the first field from your local dataset, finding a match in the dataset provided to the function (as a string), and returning the field from the row it matched to. The last parameter is the dataset to search.
Just in case you get an error... it's always a good idea to cast data to the type you want to work with in case it comes in wrong. So...
=CINT(TOTALHOURS_WO) + CINT(LOOKUP(Fields!EmployeeID.Value, Fields!EmployeeNum.Value, Fields!TOTALHOURS_SR.Value, "DataSet2"))
This assumes you have a one to one match on employee ID. If you have to SUM both fields you can try this:
=SUM(CINT(TOTALHOURS_WO)) + SUM(LOOKUPSET(Fields!EmployeeID.Value, Fields!EmployeeNum.Value, CINT(Fields!TOTALHOURS_SR.Value), "DataSet2"))
SUM for TOTALHOURS_WO will give you the SUM in your current table group (so make sure you are grouping by staff ID in the table). It will then add it to the SUM of LOOKUPSET. LOOKUPSET works the same as lookup but returns an array of matches instead of the first.
Hope this helps.

Summing Columns up with some exceptions

I am working on a database with two different tables.
The first contains every change in the database like a transaction table. It contains the object that was bought/sold, how many of them where bought/sold, when this tranaction happend and in which place.
The second table contains the total value of every object that should be available in those places.
Now here is my question:
I want to automaticly sum up every entry with the same object and location inside of table one and save this value inside of table two.
BUT
Sometimes there are special entrys in table one which should not be summed up with the other values. They should overwrite the value.
I have an example of how this summing up should look like:
n = normal value, s = special value
n: 1 sum: 1
n: 2 sum: 3
s: 7 sum: 7
n: 5 sum: 12
n: 4 sum: 16
n: 7 sum: 23
s: 20 sum: 20
To help you help me I have some additional informations:
There are 4 columns inside of table one
The first one is called object and contains the object number for which this entry takes effect.
The second column contains the amount of that object. Whether it was bought or sold.
The third column tells me on which locations this transaction belongs to. Which also means that every object has different amounts depending on the location.
The fourth column contains an information why this transaction happend. It tells me if this transaction happend because I bought something or because I sold something OR because I counted my stock.
This is the special indicator which should tell my database not to sum up this value but instead overwrite the previous one with this.
The fifth and last column contains the date when this transaction happend. This is very important because the whole table is sorted by the date. And it tells when those special values come in place.
The other table just contains the summed up value for every object in every location.
This below will return the sum of each record for a particular Object 'MyObj' starting from the last instance of a 'Special' entry (inclusive).
(Untested)
SELECT Sum(a.Amount) AS TheSum
FROM tblMyTable a
WHERE ID_PK> = nz((
SELECT max(ID_PK)
FROM tblMyTable
WHERE Object=a.Object AND IsSpecial=1
),0)
AND a.Object='MyObj'

Reporting services put data from two DataSet rows in one tablix cell

I need to create report with table which looks like this
Country 1 Country 2 Country 3 Total
Category 1 1(2) 2(1) 5(6) 8(9)
Category 2 2(3) 2(1) 4(0) 8(4)
Category 3 3(2) 2(1) 3(1) 8(4)
Total 6(7) 6(3) 12(7) 24(17)
Report contains data about TFS WI's and has information about current week's WI count and last weeks WI count (in brackets)
Data set on which this report is based on MDX query against TFS warehousw cube and has such structure:
Category Country Week Count
1 1 this 1
1 2 this 2
1 3 this 5
1 1 last 2
1 2 last 1
1 3 last 6
Trouble is, I cann't find a way how to concatenate data about current and last weeks incident count in one cell. I have toyed around with idea to do it in MDX, but with my limited MDX skills I can't see how it could be done.
Rowgroup on Category.
Columngroup on Country.
Inside the cell you should be able to have 2 placeholders with the second one in brackets. The first expression should be:
=Sum(iif(Fields!Week.Value = "this", Fields!Count.Value, 0))
The second one should be:
=Sum(iif(Fields!Week.Value = "last", Fields!Count.Value, 0))
In MDX you could create two calcs - this and last week (of course you'll need to change this to work with your cube):
WITH
MEMBER [Measures].[thisWeekCount] AS
([Date].[Week].[this], [Measures].[Count])
MEMBER [Measures].[lastWeekCount] AS
([Date].[Week].[last], [Measures].[Count])
SELECT
{
[Measures].[thisWeekCount],
[Measures].[lastWeekCount]
} ON 0,
{
...
} ON 1
FROM [Your Cube]
Then, you can use them within placeholders as jimconstable explained, but without the iif functions.
Thank you all for your answers!
I found out that main problem (reporting services allows only one measure on columns) can be solved by using Analysis server OLE DB provider. There are some drawbacks, like that parameters are not supported, but I can live with this.