SSRS linking two matrix tables - matrix

I am using SSRS 2008.
I have a report with 2 different matrix tables having two different datasets as their sources.
The data comes fine in both the tables individually.
BUT
My issue starts where I have to use data from one table to calculate percentage in the second table.
Here are the details:
Table 1:
Contains columns: Date, Referal_Status ('1' for each valid row), Department
Table 2:
Contains Columns: Date, Membership_Status ('1' for each valid row), Department
In table 1, I need to show referral counts (sum of valid Status) grouped by month in columns, and grouped by department in rows. Also an additional row and column for totals of the same.
This is implemented with no issues.
In table 2, I need to show membership counts (sum of valid Status) AND referals to membership percentage grouped by each month in columns, and grouped by department in rows. Also an additional row and column for totals of the same. The issue starts when I try to implement the percentage calculation.
Let's say I have the membership counts number for April 2014 in the membership table. How do I take the referrals count number for April 2014 from the referral table and compute the April 2014 percentage as referal_num/Membership_Num * 100
The issue that I face is the scopes of both the matrix tables being different.
Please help me attain the above in the SSRS matrix tables.
Am I providing enough information to get through to you folks about my issue? Please let me know in case you need more information from me.

This is often a road to misery, but anyway ...
I would use the Lookup Function to retrieve the Referrals count. You will need to concatenate your two key columns (Date and Department) into one expression.
This sounds great and often works well. However when it doesn't work on odd rows or combinations of data, you are flying blind trying to debug it.
Good luck!
PS: actually for a reliable solution that is easy to debug, I would go back and combine the data upstream so it can be presented to SSRS in one Dataset. I would probably use SSIS for this.

Related

How can I ensure correct filtering of a detail table from a summary table?

In this production data the Total Quantity processed through the machines is in table WeekProd and the number of parts scrapped is stored in table WeekScrap. There can be more than one scrap reason and quantity for each production line and they are summed using a measure.
The two tables are filtered in common by the calendar week number, the machine lookup and the shift lookup. Using 2 visuals shows that this filtering is working as expected:
However, when I place the Sum Scrap Qty measure onto the WeekProd visual it show the scrap qty on every row, although the total figure of 34 ends up correct.
How can I stop this from happening?

How to create a DAX cross-sectional measure?

I don't know if I even worded the question correctly, but I'm trying to create a measure that depends on what is showing in the pivot table (using PowerPivot). In the image I posted, "DealMonth" is an expression in the PowerQuery table itself that simply takes the start date of the employee and subtracts it from the month a deal was closed in. That will show how long it took for that salesperson to close the deal. "TenureMonths" is also an expression in the PowerQuery table that calculates the tenure of the person. The values populating this screenshot are coming from a total headcount measure created. What I'm trying to do is create a separate measure that will show when the "TenureMonths" is less than the "DealMonth." So if the TenureMonths is 5, then after DealMonth of 5, the value would be 0. Is this possible?
Screenshot
I should add the following information.
"DealMonth" - Comes from the FactData table
"TenureMonths" - Comes from the DimSalesStart table
These two tables are joined by name. I feel like I'm so close because I can see what I want. The second image below is a copy/paste of the pivot table result but with my edits to show what I'd want to have shown. Basically, if(TenureMonths >= DealMonth,1,0). The trouble seems to be that since they're in two different tables, I can't make it work. The rows in the fact table are transactions, but the rows in the dim table are just the people with their start and end dates.
Desired Result
This is possible with some IF([measure1]<[measure2],blank(),[measure1]), however without seeing more of the data it will be hard to guide you specifically.
However you need to create two separate measures, one for TenureMonths and one for DealMonth, depending on the data this can be done with an aggregator forumla such as sum, min, max, etc (depends if there will be more than one value).
Then reference those two measures in the formula pattern I mentioned above, and that should give you want you want.
I figured out a solution. I added a dimension table for DealMonth itself and joined to my fact table. That allowed me to do the formulas that I needed.

Custom function by date for related tables

"In a crosstab, latest month where Actuals has any data, show Actuals data for that and all previous months. Future months, show Forecast data."
.
I have two tables- Forecasts and Actuals- and the common columns between them are Team, Month, Value.
I'd like to show the data in a crosstab with Month as columns and Team as rows. I'm trying to write an expression to do this in the crosstab: The most recent month where Actuals has any data, I'd like to show Actuals data for that and all previous months, for all teams. For following months, I'd like to show Forecast data.
Any suggestions about how to go about this would be appreciated. I'm still piecing together my knowledge :)
Create a third table from a transformations:
Create Third table from - Pivot date on Team & Month (to ensure every possible combination) from first table
Add Rows from transforming the second table (pivot on Team & Month)
Join the two original tables to your newly created table (has every possible combination of Team & Month) so that both your data sets are now in one table.
Now use the third table in your cross table.
If you try using column matching instead of the above method only dates from the main table will show as the dates are matched and ones missing from the other will not display.

OBIEE Merge two queries (join)

I need help.
I am new to obiee (recently moved from business objects and re-creating all reports in obiee).
Here is an example I need help with. I have created an analysis where I am listing all orders with their target delivery dates and number of products in each order.
Order Id......Target Delivery Date...No of products
Abc....1/1/2016.....5
I want to add to a column next to No of products called "No of prods delivered on time". I want to compare delivery date of each product within a order with the target delivery date and
Give count of products delivered within the target date.. So the output should be
Abc....1/1/2016....5.....3
Where 3 is number of products delivered on time.
I could do it in BO by running two queries and merging them however in obiee I am not able to add second query to my analysis. I did try at product level using case when target date >=delivery date then 1 else 0 and wrapped this with sum function to aggregate but it didn't work ..
Appreciate your help in this. Searching for this topics give me results for running queries from multiple subject area :(
You also have unions in OBIEE, you union the results of 2 queries which return the same structure, so you have query A with Order ID, Target Date, No Products and a Dummy column with a 0 and default agregation Sum, and a second query with Order ID, Target Date, Dummy column summing 0 and the number of products delivered.
You do all this in the criteria tab of the analysis. It's important the order in which you put your columns, because that's what OBIEE is using to do the union.
Regards

SSRS Matrix Bespoke Headers (Still from datasource!!)

I have to create a matrix in SSRS to detail the number uses leaving an organisation.
The columns will all represent spaces of time spanning 1 week and the rows will all represent departements in the organisation. The detail portion will be a count of people who have left that area in that week.
I have a leaving date field in the DB but nothing that flags the specific intevals I have been told to use. That means that as the matrix is, it counts each of users that have left a specific department however the date range columns is 1 day, not 1 week. Is there a way to force the column headers to respect the week intervals I want given that they are currently coming from the dataset and are not hard coded?
Firstly try to manage your data in sql itself by using Group By with date and making each group as one week period. That way you can manage to get all data in your required format
I don't know what is your columns so I am just showing a way to get the week groups from table and get the count of the people
SELECT DATEPART(wk, datevaluecolumn) weekno
, SUM(peopleleavingcolumn) totalvalue
FROM yourTable
GROUP BY DATEPART(wk, datevalue)

Resources