[stimulsoft]: one master with three separate details - master-detail

I'm new in stimulsoft.I'm trying to build a report with three tables which I know I should use master details but I can't find a way.
well, I have three tables.
1.Info(Date,name,type,x,y)
2.cost(Date,Item,amount)
3.Bill(Date,BillNo,PaymentNo,Cost)
column Date is the key.
I want to group the information of these tables by date
and under each group I want to show the information of each table in Separate databands.in this way:
5 Sep 2016
name1,type1,x1,y1
name2,type2,x2,y2
Item1,amount1
Item2,amount2
Item3,amount3
BillNo1,PaymentNo1,Cost1
4 Sep 2016
name3,type3,x3,y3
Item4,amount4
Item5,amount5
BillNo2,PaymentNo2,Cost2
BillNo3,PaymentNo3,Cost3
there are multiple rows with equal date in tables.
I try many ways but it shows all cost and bill information per rows of info!!
Is there any way? Thanks.

Use Group Header (or Group Footer) within a DataBand.
Remember set the condition for your Group Header to your column Date like this:
{YourDataSource.Date}
By this, the Date field apear only once in the group.

Related

Datastudio: Blended Data: Datetime can't be aggregated

I have two tables case and party. Both of them are from BigQuery. In the case table, there is a date field in the DATETIME type in BigQuery. I want to plot a chart to show the number of cases per month. It works perfectly when I only use the case table.
However, when I blend the case table with the party table, the aggregation doesn't apply on the date field anymore.
This is how I join the tables.
How do make the aggregation of date & time fields in blends work as normal?
Update
I have tried to create a custom field with TODATE(date, 'RFC_3339', '%Y-%m-%d'), but the aggregation is still not applied to the custom field.
minimal example
Create a.csv in local.
a_id,date
1,2022-05-25T00:00:00
2,2022-05-25T00:00:00
3,2022-06-01T00:00:00
4,2022-06-02T00:00:00
Create b.csv in local.
a_id,b_id
1,1
1,2
2,3
3,4
4,5
4,6
Upload a.csv and b.csv into a Data Studio report.
Blend a.csv and b.csv with inner joining on a_id field. I removed "Record Count" from metrics in both tables and added all fields as dimensions.
Add a "Table" type chart using the blend created in the previous step.
Put date field as the only one dimension and select "Year Month" as the type.
Put a_id field as the only one metrics and select "Count Distinct" as aggregation.
actual result
date (Year Month)
a_id
May 2022
2
Jun 2022
1
Jun 2022
1
expected result
date (Year Month)
a_id
May 2022
2
Jun 2022
2
example report
Here
This is a bug, and it was already reported in Google's DataStudio IssueTracker.
https://issuetracker.google.com/issues/179280180
You probably want to star the issue (Google prioritize issues by the number of affected users).
Also, in the same thread, the reporting user suggests to use the above formula as a workaround.
YearMonthAsDate = DATE(YEAR(date_tran),MONTH(date_tran),1)
It worth a try.
You are changing the Date dimension in the table but in order to aggregate it on a monthly basis but joins the rows on a date base.
The solution is to change the Dimension to Month year inside the blend settings, you can do this just the same way you change a field type inside a table.

Identify elements that do not appear in the period (Google Data Studio)

I have a table that shows the recurrence of purchasing a product, with the columns: product_id, report_date, quantity.
I need to list in a table the products that are more than 50 days unsold. The opposite I managed to do (list those that were sold in the last 50 days) but the opposite logic has not yet been able to implement.
Does anyone have any tips?
An example of the table:
product_id,date,report_date,quantity
329,2019-01-02 08:19:17,2019-01-02 14:34:12,6
243,2019-01-03 09:19:17,2019-01-03 15:34:12,6
238,2019-02-02 08:19:17,2019-03-02 14:34:12,84
170,2019-04-02 08:19:17,2019-04-02 14:34:12,84
238,2019-04-02 08:19:17,2019-04-02 14:34:12,8
238,2019-04-02 08:19:17,2019-04-02 14:34:12,100
238,2019-08-02 08:19:17,2019-08-02 14:34:12,100
238,2019-10-02 08:19:17,2019-10-02 14:34:12,100
170,2020-01-02 08:19:17,2020-01-02 14:34:12,84
170,2020-01-02 08:19:17,2020-01-02 14:34:12,84
There are many steps to do this task. I assume the date column is the one to work with. Your example from table includes duplicated entries. Is it right that at the same time the order is there twice?
So here are the steps:
At first add an calculated field date_past to your dataset:
DATE_DIFF(CURRENT_DATE(),date)
To the dataset add a filter SO_demo with:
include date_past<30
Then blend the data with it self. Use product_id as Join key. Only the 2nd dataset has the SO_demo filter. Add to the dimension of this dataset the calculated field sold_last_30_days with the formula "yes".
In the table/chart to display add a filter on the field include sold_last_30_days is Null.

Summing up values from one column into one row on a different table when joining

I've only had a (frustrating) couple days experience with SQL Server, and I need some help, since I cant find anything related to my question when searching.
For background info, I'm working in an accountancy, and right now I'm trying to create a table for balance statements to use in crystal reports. Each invoice has multiple items, but for the statement I need to sum them all up with the invoice reference being the information that links the group of data that needs to be summarised.
So, what I need is to pull information from one table (dbo.SalesInvItems), this information including the date (InvDate), the due date (InvDueDate), and the customer name (CustomerName). This information stays the same with the Invoice Reference (InvRef), and it's what I want to use to link the two tables.
For example, Invoice Reference: 1478 will always have the date 14/05/18, the due date: 14/06/18 and the customer name: Pen Sellers Ltd.
The same Invoice Reference is used by multiple rows, but the only thing that changes (that I need) is the Invoice Item Total (InvItemTotal).
For example, the one reference will always be addressed to Pen Sellers, but one item has the Total as £13 and another item using the same reference is £20.
The Invoice Item Total is what I need to sum up. I want to add all the Invoice Item Total's together that have the same Invoice Reference, while joining the tables.
Sales Invoices
So when I've inserted the references into the table (sorry they're not the same in both pictures, I was having problems making examples and I made a mistake), I want to grab the information from the Invoice table to fill it in, going from this...
Pre Solution
To this...
Desired Result
The desired location is a table called dbo.Statement.
1.Is this even possible to do?
2.How would I go about doing this?
3.Is there a method I could use that would make sure that every time I insert an Invoice Reference into the Statement table, it would automatically pull out the data needed from the Invoice Table?
If any additional information is needed, just say and I'll do my best to provide it, I have never asked a question on here before and I'm new to SQL Server and coding in general.
Im using SQL Server Management Tool 2017
Thank You
Select item.InvRef
, item.CustomerName
, item.InvDate
, item.InvDueDate
, Sum(item.InvItemTotal) InvAmt
, sum(IsNull(payments.Amount,0)) PayAmount
, Sum(item.InvItemTotal) InvAmt - sum(IsNull(payments.Amount,0)) as Balance
from SalesInvItems item
left join payments -- you didn't define this
on item.InvRef = payments.InvRef
group by item.InvRef
, item.CustomerName
, item.InvDate
, item.InvDueDate
Select item.InvRef
, item.CustomerName
, item.InvDate
, item.InvDueDate
, Sum(item.InvItemTotal) InvAmt
from SalesInvItems item
left join Statement
on item.InvRef = Statement.Reference
group by item.InvRef
, item.CustomerName
, item.InvDate
, item.InvDueDate

How to Eliminate #Error Columns in Tablix Crosstab Group

Imagine a one-table query that accepts a year (range) as a parameter and then yields a dataset grouped by State, City, and Month, with a count of UFOs, if any, for each month.
Tie that dataset to an SSRS Tablix, with a crosstab layout:
The Row Groups are State, City;
The Column Group is the Month (Jan through Dec); and
The row-column intersections are the # of UFOs sighted, if any.
PROBLEM:
If I run the (parameterized) report for one location, even one with few sightings, all goes well: I see columns only for months with sightings.
However, if I report more than one location (say, "Albany," with daily sightings, and "Troy," with October-only), Troy's grouping will come out ugly: If reported alone, just the October column would show, but, now, October along with 11 columns of "#Error" for the month name and a "0" for UFO count appear.
I suspect that one solution may involve some 0- or NULL-fill of missing-month data for Troy and other cities (How?), but is there some other way, via the Tablix widget, to achieve the desired result?
I don't understand what you're doing wrong but the matrix usually works with filling the headers correctly and leaving blanks where there is no data for a single group.
It might help if you show your design view.
Design View:
Report View:
Many of the users don't have data for previous months but at least one does so the month is displayed in the header. The blanks are where there is no data for that month/user combo.
I don't see why your report isn't working like this. If I only selected one user, then only the months that user had will be displayed.

Is it possible to create an SQL query that displays results like this?

Background
I have a database that hold records of all assets in an office. Each asset have a condition, a category name and an age.
A ConditionID can be;
In use
Spare
In Circulation
CategoryID are;
Phone
PC
Laptop
and Age is just a field called AquiredDate which holds records like;
2009-04-24 15:07:51.257
Example
I've created an example of the inputs of the query to explain better what I need if possible.
NB.
Inputs are in Orange in the above example.
I've split the example into two separate queries.
Count would be the output
Question
Is this type of query and result set possible using SQL alone? And if so where do I start? Would it be easier to use Ms Excel also?
Yes it is possible, for your orange fields you can just e.g.
where CategoryID ='Phone' and ConditionID in ('In use', 'In Circulation')
For the yellow one you could do a datediff of days of accuired date to now and divide it by 365 and floor that value, to get the last one (6+ years category) you need to take the minimum of 5 and the calculated value so you get 0 for all between 0-1 year old etc. until 5 which has everything above 6 years.
When you group by that calculated column and select the additional the count you get what you desire.

Resources