Multiple tablix for report - visual-studio

i have the following scenario i am trying to simplify using Visual Studio and Microsoft BI Stack (SSRS).
I have a Dataset as follows.
Year Employee Sales
1 A 5,000,000
2 A 7,500,000
3 A 6,500,000
1 B 3,500,000
2 B 5,000,000
3 B 8,000,000
1 C 5,750,000
2 C 7,500,000
3 C 6,500,000
1 D 4,500,000
2 D 5,500,000
3 D 6,100,000
I am trying to create a report whereby, a single report would span 3 Tablix inside report body when run to display as follows.
Year 1
Year Employee Sales
1 A 5,000,000
1 B 3,500,000
1 C 5,750,000
1 D 4,500,000
Year 2
Year Employee Sales
2 A 7,500,000
2 B 5,000,000
2 C 7,500,000
2 D 5,500,000
Year 3
Year Employee Sales
3 A 6,500,000
3 B 8,000,000
3 C 6,500,000
3 D 6,100,000
Now i know i could replicate the Tablix 3 times in the report body, but that would be a bad idea when it comes to maintaining this report.
In the effort to avoid repeating myself, is there a way to loop the Tablix (N Times) in SSRS where condition would be the Year column (values 1, 2, 3.....)?

Following are the steps :-
Insert a List. Group it by the Year.
Put your tablix inside the list.
This should do it.

What you want to do is to NEST two tables.
First, create your table that gives you all the results like you want.
Then create a second table with one column and one row and Group it by your Year field.
Place your first table in the second table's so that it repeats for each year.

Related

Running distinct count in quicksight

I want to implement a running distinct count with Amazon Quicksight. Here's an example of what that would look like:
Date
ID
Amount
Running Distinct Count
1/1/1900
a
1
1
1/2/1900
a
3
1
1/2/1900
b
6
2
1/4/1900
a
3
2
1/8/1900
c
9
3
1/22/1900
d
2
4
I've tried runningSum(distinct_count, [Date ASC]), but this returns a sum of the distinct counts for each aggregated date field.
Can this be implemented in QuickSight?
You can use this workaround to get the same functionality as runningDistinctCount() as follows:
runningSum(
distinct_count(
ifelse(
datetime=minOver({Date}, [{ID}], PRE_AGG),
{ID},
NULL
)),
[{Date} ASC],
[]
)
This would give you the runningDistinctCount of ID's over the Date field. It achieves it by considering just the first time the ID appears in the dataset, counting these and finally doing a runningSum on these counts.

Insert empty row which shows total when Item number get change

In my report, there is a table which shows Item number, Employee name, and Hours.
Item Number Employee Hrs
1 ABC 2
1 DEF 1
2 ABC 3
2 XYZ 4
I want to show one empty row below as a separator when Item number get change. In that row want to show the total number of hours. Like below.
Item Number Employee Hrs
1 ABC 2
1 DEF 1
Total 3
2 ABC 3
2 XYZ 4
Total 7
Thanks, Bhushan the link was helpful. Link: https://learn.microsoft.com/en-us/sql/reporting-services/lesson-6-adding-grouping-and-totals-reporting-services?view=sql-server-2017.
I changed the report design by adding grouping. Also showing sum after each group.

Complex Networks in Hive - Optimization Code

I have a problem with how to get my Hive code optimized.
I have a huge table as follows:
Customer_id Product_id Date Value
1 1 02/28 100.0
1 2 02/02 120.0
1 3 02/10 144.0
2 2 02/15 120.0
2 3 02/28 144.0
... ... ... ...
I want to create a complex network where I link the products through the buyers. The graph does not have to be directed and I have to count the number of links between them.
In the end I need this:
Product_x Product_y amount
1 2 1
1 3 1
2 3 2
Can anyone help me with this?
I need an optimized way to do this. The join of the table with itself is not the solution. I really need an optimum way on this =/
CREATE TABLE X AS
SELECT
a.product_id as product_x,
b.product_id as product_y,
count(*) as amout
FROM table as a
JOIN table as b
ON a.customer_id = b.customer_id
WHERE a.product_id < b.product_id
GROUP BY product_x, product_y;

Filter in Excel 2016 using the same date range on multiple columns

I'm trying to display rows when any of the columns B, C, D, E, or F has a date no more than 10 days old. It doesn't matter if any of the other columns have dates more than 10 days old.
I tried advanced filters and filter on filter but if there is a date in any of the columns more than 10 days old it won't display the row.
Any help is appreciated.
A B C D E F
1 Item Submitted to Ann to Joe from Ann from Joe
2 381-02 07/06/18 07/06/18 07/24/18
3 480-00 06/29/18 06/29/18 07/24/18 07/24/18 07/25/18
4 483-00 07/02/18 07/03/18
5 490-00 07/06/18 07/07/18 07/24/18 07/25/18 07/25/18
6 491-00 07/06/18 07/07/18 07/24/18
7 492-00 07/06/18 07/07/18
8 493-00 07/10/18 07/10/18 07/25/18 07/26/18
Display the row if any date in these columns (D-H)
is greater than 10 day from today.
If you are looking to do this without vba and only use ecxel function then you need to make a nested if (in a new column) and use the OR operator. So in the end if any of the cells in the rows is greater then 10 days write 1 if false write 0
And just sort your new column by 1

What if the value of order field is the same for all the records [duplicate]

This question already has answers here:
Why does Oracle return specific sequence if 'orderby' values are identical?
(4 answers)
Closed 7 years ago.
All, Let's say the SQL looks like below.
Select a, b ,c from table1 order by c
If all the rows in table1 have the same field value in the field c. I want to know if the result has the same order for each time I executed the SQL.
Let's say data in the table1 looks like below.
a b c
-------------------------------------------
1 x1 2014-4-1
....
100 x100 2014-4-1
....
1000 x1000 2014-4-1
....
How Oracle determine the rows sequence for the same order by value?
Added
Will they be random sequence for each time?
One simple answer is NO. There is no guarantee that the ORDER BY on equal values will return the same sorted result every time. It might seem to you it is always stable, however, there are many reasons when it could change.
For example, the sorting on equal values might defer after:
Gathering statistics
Adding an index on the column
For example,
Let's say I have a table t:
SQL> SELECT * FROM t ORDER BY b;
A B
---------- ----------
1 1
2 1
3 2
4 2
5 3
6 3
6 rows selected.
The sorting on the column having similar values is just like:
SQL> CREATE TABLE t1 AS SELECT * FROM t ORDER BY b, DBMS_RANDOM.VALUE;
Table created.
SQL> SELECT * FROM t1 ORDER BY b;
A B
---------- ----------
1 1
2 1
4 2
3 2
5 3
6 3
6 rows selected.
So, similar data in bot the tables, however, ORDER BY on the column having equal values, dos not guarantee the same sorting.
They must not be random (change each time), but the order is not guaranteed (change sometimes).

Resources