How to get the first value and remove all duplicate value in data studio - google-data-studio

I'm trying to create a table to show emails by country in data studio but there are many duplicate emails displayed.
Country
Email
Date Created
Country A
Email A
Jan 1, 2022
Country A
Email B
Jan 12, 2022
Country A
Email C
Jan 15, 2022
Country B
Email A
Jan 12, 2022
Country B
Email D
Jan 20, 2022
Country B
Email E
Jan 21, 2022
Country C
Email F
Jan 12, 2022
Country C
Email D
Feb 02, 2022
Country C
Email B
Feb 03, 2022
I would like to keep the first generated email and remove all duplicate emails, like that:
Country
Email
Date Created
Country A
Email A
Jan 1, 2022
Country A
Email B
Jan 12, 2022
Country A
Email C
Jan 15, 2022
Country B
Email D
Jan 20, 2022
Country B
Email E
Jan 21, 2022
Country C
Email F
Jan 12, 2022
Can someone help me?
Thanks,

Related

MonthName-Year as SSRS parameter

I have dimTime table below:
TheYear Fiscalyear TheMonthName TheMonth
2022 2022 - 2023 November 11
2022 2022 - 2023 October 10
2022 2022 - 2023 September 9
2023 2022 - 2023 February 2
2023 2022 - 2023 January 1
How to implement the MonthName and Year as SSRS parameter and have this in the main dataset? Like below:
Select Month-Year: January-2023
Dataset: Select
from Table
where date = selected MonthYear from the parameter
This will also goes to same report but the selection is Fiscal year:
*Select Fiscal Year: 2022-2023
Dataset: Select
from Table
where date = selected FiscalYear from the parameter
Im trying to convert it to date but dont know where to start.

Format Date, sort as calendar and use as SSRS parameter

I have a DateTime field that I want to summarise and format to YYYY mmm, then use as an SSRS parameter to filter my query.
Q1. When I use the format option the dates I get back are sorted as text e.g.
2022 Apr
2022 Feb
2022 Jan
2022 Mar
Q2. How do I sort as per the calendar e.g.
2022 Jan
2022 Feb
2022 Mar
2022 Apr
Q3. How do I use the values of this parameter in my WHERE clause to filter my dates? So if someone chooses "2022 Mar" I only get data where the DateTime field contains March 2022.
try_convert(date,...) will assume the 1st of the month if no day is given
Example
Declare #YourTable Table ([SomeCol] varchar(50))
Insert Into #YourTable Values
('2022 Apr')
,('2022 Feb')
,('2022 Jan')
,('2022 Mar')
Select *
From #YourTable
Order By try_convert(Date,SomeCol)
Results
SomeCol
2022 Jan
2022 Feb
2022 Mar
2022 Apr
You can sort it out by just using 'ORDER BY'
EX:
CREATE TABLE #TEMP_DATES
(Month_Year Date)
INSERT INTO #TEMP_DATES
SELECT
'2022 APR',
'2022 FEB',
'2022 JAN'
SELECT * FROM #TEMP_DATES
ORDER BY Month_Year

How to show the history records up to financial year end day. POWER BI

I have a data set like this
Year
Records
2020
1
2020
2
2021
3
2021
4
2022
5
2022
6
I want show all the history records up to the selected year in Slicer:
2020
2021
2022
For example, if I select 2020, it should show:
Year
Records
2020
1
2020
2
And if I select 2021, it should show:
Year
Records
2020
1
2020
2
2021
3
2021
4
If I select 2022, it should show:
Year
Records
2020
1
2020
2
2021
3
2021
4
2022
5
2022
6
I am very appreciated if you have some ideas for me.
Regards
Use a "less than or equal to" Numeric Range Slicer on the Year

Select value of first row where column value matches

I have two sheets in the Google sheet with the following pattern and data
raw sheet
Projects
start date
end date
status
Proj1
July 1, 2021
July 10, 2022
In Progress
Proj2
July 11, 2021
July 20, 2022
Done
Proj1
July 21, 2021
July 25, 2022
Done
and another sheet
project analysis
Projects
start date
end date
status
Time taken (days)
Proj1
July 1, 2021
July 25, 2022
Done
24
Proj2
July 11, 2021
July 20, 2022
Done
10
The values in the project analysis has been manually field, but I want it to automate as follow
set start date in project analysis to the start date column of the first entry from raw sheet
set end date in project analysis to the end date column of the first entry from raw sheet where status is Done
How can I accomplish this in Google sheet?
try:
=ARRAYFORMULA(QUERY({A:C, B:C*1},
"select Col1,min(Col2),max(Col3),'Done',max(Col5)-min(Col4)
where Col1 is not null
group by Col1
label min(Col2)'start date',max(Col3)'end date','Done''status',max(Col5)-min(Col4)'time taken in days'", 1))
In excel ---
Formula in Column B
=VLOOKUP(A13,$A$2:$B$4,2,FALSE)
Array formula in Column C
=INDEX($C$2:$C$4,MATCH(1,(A13=$A$2:$A$4)*("Done"=$D$2:$D$4),0))
Refer INDEX and MATCH with multiple criteria
Formula in Column D
=IF(NOT(ISNA(C13)),"Done","In Progress")
start date:
=ArrayFormula(IF(A2:A="",,VLOOKUP(A2:A,raw!A:B,2,FALSE)))
end date:
=ArrayFormula(IF(A2:A="",,VLOOKUP(A2:A,FILTER(raw!A:C,raw!D:D="Done"),3,FALSE)))

Display the Month and Value of the Highest Sale by Customer

Using Google Data Studio, I want to make a report on Highest Sale done by Each Customer with Which Month the Highest sale was done.
Pleases find below link for Google Sheet data:
https://docs.google.com/spreadsheets/d/1g20m5jVs9BX1-oCeOu_W4OUq5E2Loi-e6-XXufd7cBM/edit?usp=sharing
Using the below data I arrived the Highest sales of each customer using Max but unable to get in which month the highest sale was done.
Google Data Studio Link:
https://datastudio.google.com/reporting/45c04f04-e239-41a0-9ee4-69e0331f8d3d
Customer Name Month Sales
AA Oct 301
BB Apr 3,154
BB May 3,113
BB Jun 5,431
BB Jul 10,185
BB Aug 6,123
BB Sep 3,147
BB Oct 6,154
BB Nov 9,818
BB Dec 6,547
BB Jan 6,035
BB Feb 15,231
BB Mar 3,719
CC Apr 18,092
CC May 20,926
CC Jun 27,897
CC Jul 23,959
CC Aug 23,428
One way that it can be achieved is by:
1) Chart Type
Pivot Table
2) Fields
Row Dimension #1: Customer Name
Row Dimension #2: Month
Metric: Sales
3) Sorting
Row #1: Customer Name; Order: Ascending; Number of Rows: Auto
Row #2: Sales; Order: Descending; Number of Rows: 1
Google Data Studio Report and a GIF to elaborate:

Resources