Expressions and Filters SSRS - visual-studio-2010

I have a few things I am struggling with so hopefully I can ask all at once ?
I am using VS 2010 and I think with Vb.net to build reports, I use databases from Sql - I am mainly using matrix tables
I have a report that is multiple tables in one but not sure how to set/define to still show the tables that has no data ? So currently if there is a blank one it messes up the full report look ?
In another scenario how can I use an expression/custom code to filter out items in one row - in a calculation for example if I only want to sum 3 items of 5 etc
How can I work out % of a row or coloumn based on criteria or filters so if total items is 30 and item 1 is 5 the % of will be 17% and all items will total to 100%
How can I work out growth of the row/column so if year 1 is 50 and year 2 is 60 the growth/variance will be 20%

There are some issues with the expressions:
=IIF(Fields!Total_Amount__Excl_VAT_.Value = 0
OR Fields!Total_Amount__Excl_VAT_.Value = "", 0, Sum(Fields!Total_Amount__Excl_VAT_.Value))
The SUM should be around the IIF:
=SUM(IIF(Fields!Total_Amount__Excl_VAT_.Value = 0
OR Fields!Total_Amount__Excl_VAT_.Value = "", 0, Fields!Total_Amount__Excl_VAT_.Value))
The same issue for
=IIF(Fields!Total_Amount__Excl_VAT_.Value = 0
OR Fields!Total_Amount__Excl_VAT_.Value = "",0,Sum(Fields!Total_Amount__Excl_VAT_.Value))
Should Be:
=SUM(IIF(Fields!Total_Amount__Excl_VAT_.Value = 0
OR Fields!Total_Amount__Excl_VAT_.Value = "", 0, Fields!Total_Amount__Excl_VAT_.Value))
The growth formula looks correct - are you getting a different result than expected?

Related

Business Objects 4.x: need to combine two queries similar to a UNION

I can't seem to figure out how to combine the result of 2 Business Objects queries.
Both queries return a set of codes and a number of hours. Query 1 can have codes that do not appear in Query 2, and Query 2 can have codes that do not appear in Query 1.
The resulting report should contain all codes from both Query 1 and Query2, a column with the sum of hours from Q1 for that code, and a column with the sum of hours from Query 2 for that code. If one of the queries doesn't have a code in it, it would return a blank or 0 total.
Example:
Q1 results:
|Code|Value|
|:---|:----|
|A|15|
|A|17|
|B|12|
|D|22|
|D|35|
|E|16|
|E|9|
|E|11|
Q2 results:
|Code|Value|
|:---|:----|
|A|5|
|A|19|
|B|33|
|C|17|
|C|24|
|E|78|
|E|12|
Report:
|Code|Value1|Value2|
|----|------|------|
|A|32|24|
|B|12|33|
|C| |41|
|D|57| |
|E|36|90|
|Total|137|188|
When I create the Business Object report table as normal, only the values of Query 1 are used, and I miss the row for value C. If I flip the queries around, I miss the row for value D.
How do I set up my report to show all the code values?
Edit: Sorry for the formatting of the tables, in the preview it looks perfect. :(

Match query with relationship is taking too long to retrieve results does it mean we need to upgrade Neo4j or memory allocated?

I'm trying to understand why below query is taking too long to retrieve results. I have mocked up the values used but the below query is right and is returning 40 records (a node has 8 diff values and z node has 5 diff values so total 40 combinations). It's taking 2.5 min to return those 40 records. Please let me know what the issue is here. I'm suspecting this to be Neo4j version and infrastructure we're using right now in production.
After the below query we have algo.kShortestPaths.stream so the whole thing together is taking more than 5 min. What do you suggest? Is there no other way where we can handle such combinations (a and z node combinations > 40) within 5 min?
Infrastructure details: Neo4j 3.5 community edition
2 separate datacenters, sync job - 64GB mem 16GB CPU 4 cores
Cypher Query:
MATCH (s:SiteNode {siteName: 'siteName1'})-[rl:CONNECTED_TO]-(a:EquipmentNode)
WHERE a.locationClli = s.siteName AND toUpper(a.networkType) = 'networkType1' AND NOT (toUpper(a.equipmentTid) CONTAINS 'TEST')
WITH a.equipmentTid AS tid_A
MATCH pp = (a:EquipmentNode)-[rel:CONNECTED_TO]-(a1:EquipmentNode)
WHERE a.equipmentTid = tid_A AND ALL( t IN relationships(pp)
WHERE t.type IN ['Type1'] AND (t.totalChannels > 0 AND t.totalChannelsUsed < t.totalChannels) AND t.networkId IN ['networkId1'] AND t.status IN ['status1', 'status2'] )
WITH a
MATCH (d:SiteNode {siteName: 'siteName2'})-[rl:CONNECTED_TO]-(z:EquipmentNode)
WHERE z.locationClli = d.siteName AND toUpper(z.networkType) = 'networkType2' AND NOT (toUpper(z.equipmentTid) CONTAINS 'TEST')
WITH z.equipmentTid AS tid_Z, a
MATCH pp = (z:EquipmentNode)-[rel:CONNECTED_TO]-(z1:EquipmentNode)
WHERE z.equipmentTid=tid_Z AND ALL(t IN relationships(pp)
WHERE t.type IN ['Type2'] AND (t.totalChannels > 0 AND t.totalChannelsUsed < t.totalChannels) AND t.networkId IN ['networkId2'] AND t.status IN ['status1', 'status2'])
WITH DISTINCT z, a
return a.equipmentTid, z.equipmentTid
This query was built to handle small combinations upto 4 total a and z node combinations but today we might have combinations greater than 10 or 40 or 100 so this is timing out. I'm not sure if there's a better way to write the query to improve performance assuming the community edition is good enough for our case.

DAX or POWER Query recursive calculation

Please advise if the below case may have a solution in DAX, Power query.
Have a model in Excel to identify reorder points based on Min/Max levels over 52 time periods (year). It works perfectly with 1 item, start having difficulties with 3,000 part #s (array formulas and chain calculations) therefore trying to rebuild that with DAX. Was able to reproduce all columns in DAX except for [Reorder] and [Inbound], spits out circular dependency error. I understand that DAX was not meant to be used for recursive calculations, however, I am sure there must be a workaround.
This is an abstract of an Excel spreadsheet (1 with part #)
where:
Safety, Min & Max - stock levels
LT Weeks - lead time (time between ordering and restocking)
INV_0 - opening inventory = Closing inventory from the previous period
INV_1 - closing inventory
Demand - outbound quantity = separately modeled forecast
Inbound - inbound = Quantity reordered [LT Weeks] periods ago
Reorder - reorder quantity =
IF (
[INV_1] - [DEMAND] + [INBOUND] + [PIPELINE] <= MIN,
[MAX] - ( [INV_0] - [DEMAND] + [INBOUND] + [PIPELINE] ),
0
)
Pipeline - sum of quantities reordered in preceding [LT weeks] interval -1
Total inv = INV_1 + [Pipeline].
Help would be much appreciated.

Count amount separately depends on field value in Crystal Report VS2010

I am a beginner for Crystal report. I do not know how to work with formula editor.
My question is,
Table Name - Expenses
Field Name - Date, Purpose(Text), Less(Boolean), Amount(Double)
I want to count Less(Yes) Amount separately and Less(No) Amount separately. How to count this.
Please help me..
You will need two formulas:
Formula will show 1 for each record that has Less = True:
if less = True then 1
else 0
Formula 2 will show 1 for each record that has Less = False:
if less = False then 1
else 0
Now put those two formulas in your detail section and then do a sum on each one in your group footer. You can suppress the formulas in the detail section if you don't want to see them.
Hope that helps,
Chris

Add a Dynamic Total Row at the Bottom of Excel Spreadsheet Generated by VB.NET and SQL

I have an Excel Spreadsheet that I generated dynamically using SQL and VB.NET. The number of columns (2) will never change, however the number of records will change according to what data the user has specified. After the SQL has run and has filled the spreadsheet, I need to add a record at the bottom of the table that displays the total(int value) of the records in column 2.
Something like:
xlSheet.Range(bottom record, column1) = "Total"
xlSheet.Range(bottom record, column2) = Sum of all above records in column 2
I am using VS 2010 and Excel 2010.
My tables resembles this:
*Group* *Refered Cases*
4H BOSS 0
4H BSG 0
4H SALES AND MKTG 0
ACCOUNTS RECEIVABLE 0
ASSET MANAGEMENT 0
AUDIT 0
BOSS 0
CORPORATE BSG 0
CUSTOMER SUPPORT 0
NETWORK ENGINEERING 0
PRODUCTION ENGINEERING 0
PRODUCTION OPERATIONS 0
SECURITY 0
SNFAL PRODUCT TEAM 0
VOICE SERVICES 0
XEROX 0
ANSWER:
Ok, I was able to use the following code to dynamically find the last cell of the first column and input "TOTAL" into the cell and also format it accordingly.
Dim lTotalRows As Long, lTotalCols As Long
lTotalRows = xlSheet.UsedRange.Rows.Count
lTotalCols = xlSheet.UsedRange.Columns.Count
With xlSheet.Range("A" & (lTotalRows + 1).ToString) 'Dynamically finds the last cell of the first column, and sets it equal to "Total" and formats the cell
.Value = "TOTAL"
.Interior.ColorIndex = 41 'Cell Background Changed to Black
.Columns("A:B").EntireColumn.AutoFit()
With .Font
.ColorIndex = 2 'Cell Font Changed to White
.Bold = True
.Underline = Excel.XlUnderlineStyle.xlUnderlineStyleSingle
End With
End With
I was able to use the following code to set the last cell of the second column equal to the sum of all of all cells of the second column.
Dim totals as Integer
For Each dr As DataRow In dt.Rows
totals += dr.Item(1)
Next
xlSheet.Range("B" & (lTotalRows + 1).ToString).Value = totals
If you know the number of total rows, you could insert the formula below into the cell at the bottom of the column. Your example data shows 16 rows, not including the top header row.
=SUM(INDIRECT(ADDRESS(ROW()-16,COLUMN())):INDIRECT(ADDRESS(ROW()-1,COLUMN())))

Resources