Data Studio - Percentage Breakdown from multiple columns - google-data-studio

I have a Google Sheet connected to a Google Data Studio file. The data is structured as follows:
ID Stream1 Stream2 Stream3 Total
001 10 5 5 20
002 5 10 15 30
003 100 20 5 125
004 50 0 0 50
Is there any way in Data Studio to produce a percentage breakdown of the Total field based on the various Stream fields? I was thinking of a Tree map chart, so Stream1 should have a box showing 8.8%, Stream2 13.3% etc.

In your DataStudio, Create a new field called "Stream1%". In the definition of that field, code up the Formula as "Stream1/Total". This will give you a new field you can add to your tables and charts. You can now add "Stream1%" into your table and flag it as Numeric > Percentage. You will now have a column the result you want.

Related

Google Datastudio - Extract Values from Comma separated String

I have a Sheet in which i import daily a CSV of reporting containing a column which contains comma separated values containing locations and a value
Item ID
Location results
112
Location A :1;Location B:3;Location C:4;Location D:1
113
Location A :5;Location F:1;Location X:9;Location Z:1
116
Location AA:3
I need to generate report in google datastudio that looks like showing the value after the : of that specific location. And i don't want to make too many manual changes every time to every sheet in Gsheets, so i hope that datastudio formula can solve this for me.
Another issue is that the Location names need to be an exact match as some names contain similar words like "Brussels North", "Brussels", "Antwerp North"
The news item ID is unique for each row
Any idea how i can get this data in datastudio?
Thank you
Tom
In Excel i got this to work via =IFNA(VLOOKUP($D$2:$D$7,TRIM(TEXTSPLIT(INDEX($B$2:$B$100,MATCH(E1,$A$2:$A$100,0)),":",";")),2,0),"")
I would need a view like this
Results view
Location
112
113
116
Location A
1
5
0
Location B
1
0
0
Location AA
0
0
3
Here's one approach:
as shown in the screenshot you can paste the raw csv import data in columns A, B
the arrayformula in D2 arranges the data that's compatible with the expected output in data studio
D2 formula:
=QUERY(ARRAYFORMULA(SPLIT(FLATTEN(A2:A&"|"&BYROW(B2:B,LAMBDA(hx,SPLIT(JOIN("",BYCOL(SPLIT(hx,";"),LAMBDA(ax,REPT(TRIM(REGEXEXTRACT(ax,"(.*):.*$"))&"|",--REGEXEXTRACT(ax,":(\d+)$"))))),"|")))),"|",0,0)),"Select * Where Col2!=''")
Connect columns D, E to data studio
Create pivot table with
Location as Row dimension
Item ID as column dimension
Item ID in metric with COUNT as aggregation

Create a table in Data Studio that shows current/latest value and a previous value and compares them

I have two sheets in a Google Sheet that has historical data for some internal programs.
programs
high level data about each program
each program has data for all of the different report dates
metrics
specific metrics about each program for each report date
Using my example data, there are 4 programs: a, b, c, and d and I have reports for 1/1/2020, 1/15/2020, 2/3/2020, and 6/20/2020.
I want to create a Data Studio report that will:
combine the data on report date and program
show a filter where the user can select which previous report date they want to compare against
the filter should show all of the previous report dates and default select the most recent one
for example, the filter would show:
1/1/2020
1/15/2020
2/3/2020 (default selected)
the filter should only allow selecting one
a table showing values for current report date and values for the report date selected in the above filter
Here is an example table using the source data in my above linked Google Sheet when the report is initially loaded and the filter has 2/3/2020 default selected:
report date
program
id
l1 manager
status
current value
previous report date value
direction
6/20/2020
a
1
Carlos
bad
202
244
up
6/20/2020
b
2
Jack
bad
202
328
up
6/20/2020
c
3
Max
bad
363
249
down
6/20/2020
d
4
Henry
good
267
284
up
If the user selects 1/1/2020 in the filter, then the table would show:
report date
program
id
l1 manager
status
current value
previous report date value
direction
6/20/2020
a
1
Carlos
bad
202
220
up
6/20/2020
b
2
Jack
bad
202
348
up
6/20/2020
c
3
Max
bad
363
266
down
6/20/2020
d
4
Henry
good
267
225
down

GDS doesn't show all rows / sum all values when I have 2 same rows of blending data

GDS doesn't show all rows / sum all values when I have 2 same rows of blending data.
I am doing a report that shows data filtered by email.
It took me 2 days but hopeless to find the root cause
Please see the screenshot for what I mean
https://i.stack.imgur.com/KJJAn.png
Here's the GDS file.
https://datastudio.google.com/s/kPkRpwDTqbc
The values which should be summed up, need to be in the metrics. Then following result is archived:
Again your raw data:
Date Sales
Rep Bill ID
Qty
Price
Total
Amount
04/08/2021
Dove
12345
1
1
1
04/08/2021
Jone
12346
1
2
2
04/08/2021
Jone
12346
1
2
2
and
Staff
Email
Dove
dove#gmail.com
Jone
dotuanviet1981#gmail.com
For joing, these values have to be in metrics, marked yellow. You put them in dimension - marked red - and therefore these counted once vor duplicated data.

Need to add dynamic columns in headers in SSRS report

I need to add column headers in SSRS report but that are dynamic in nature.
For example, sometimes Query will return 5 different named columns with it's data and sometime will return 9 different named columns with it's data and so on.
So how to drag or refresh columns in Dataset and how to show in SSRS report dynamically.
I am totally confused seen many articles but not able to get solution.
How to implement this in SSRS report. I have the query, depending on parameters columns gets generated. Check below sample report preview
its showing date in different columns
In SSRS , the dataset must always return the same number of columns with the same names and datatypes, so you cannot of what you want directly.
You have two options.
Option 1
Normalise the data.
So instead of returning something like
SomeID ColumnA ColumnB ColumnC
1 10 20 30
2 15 25 35
3 100 200 300
You need to return
SomeID ColName Amount
1 'ColumnA' 10
1 'ColumnB' 20
1 'ColumnC' 30
2 'ColumnA' 15
2 'ColumnB' 25
2 'ColumnC' 35
3 'ColumnA' 10
3 'ColumnB' 200
3 'ColumnC' 300
Once you have your data in this format, you can simply use a matrix in your report. Set the rowgroup to SomeID, set the Column Group to ColName and the data value to Amount
This is by far the simplest solution.
Option 2
Deconstruct and rebuild the table in code
There are several drawbaks to this method but if you are interested, read my answer to this question asked a few days ago
SQL Server - SSRS - Display the content of a Table/View directly in the report (and not using table/matrix)

How to sum SSRS Matrix Columns on Row Group

I have a report that displays the total hours a person worked for each project they are assigned to, aggregated on month. I would like to sum the total hours for each person, for each month, in SSRS 2008 R2. So, for example, I have the follow data and would like to column totals like so:
January February March
Worker 1
Project1 50 80 20
Project2 30 10 60
Project3 10 40 5
Total: 90 130 80
Worker 2
Project1 20 40 60
Project2 10 30 10
Porject3 30 10 50
Total: 60 80 120
Everything I have tried so far either sums each column for all workers combined (summing by 'Month' column group) or sums all hours for each worker (Summing by 'Person' row group).
For completeness, my row groups are:
Person
Project
RowGroup
My Column groups are:
Month
ColumnGroup
I know that I can create another query/data set to do this, but I was hoping that SSRS can do this fairly easily. It seems like a trivial problem and perhaps I am just missing something.
Any help would be great or perhaps this is something that SSRS can't do.
If you are trying to add a Column containing totals, it is pretty simple just
right click on cell --> Totals --> Column
As shown here

Resources