i've got a datasheet with a bunch of tasks, their start/end time, duration and start day.
Task
Start Time
End Time
Duration
Start Day
Task1
21:00
22:15
1:15
Monday
Task1
21:20
23:30
2:10
Monday
Task2
23:00
23:20
0:20
Tuesday
What I'm trying to do is put this data into a new calculated table that would split each task and plot a new row for the mins spent in each hour, as determined by the duration. For example:
Task
Hour
Mins in Hour
Start Day
Task1
21
60
Monday
Task1
22
15
Monday
Task1
21
40
Monday
Task1
22
60
Monday
Task1
23
30
Monday
Task2
23
20
Tuesday
I'm having no luck, could anyone help please?
Can be done with PQ
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("tZg9bhwxDIXv4tqFSEkzs3uHVHFnuDCQVAGSwnCR20cSn2YkhtLsxk5FwP6WoB5/xNHz88PT69sPenh8YHf1TmxYknXuStk+vX9/+/b6++HlUVgWhgpL15ito2twY9a55jcO9oStMQQrBt+z7iJssZoN6W90UWcj+2xgS3zJMvzSxK+rLM7G1tk0i7PxJIbb/W5ytmoddBmwVHORc+746mjMOvh1Hn79iF2vIUK7KPr6YQwr/K435O3fWDkbzmiyC+JNdoVfHrOib7LwO9ZsQe0kPTbosI1ZB78BfoPl17M6XMDhsv3y6+eMdWDdLWybZJNtRLuc+T1Ei4iBJ2wVTdg0TCZsFa1rohM2RmGLPfOLZBRrshFnS5rVYh/6jfAbrwx9eahvw040y2FRQCoO1F+GqEQbJMqcNSPa+1FCrFILZAYQBXXw6tr+0RIodFa54Q63d7MerO/bUrElYSzTLttl7HYDgggYg5cM9CKoU6hVih3K/chT6NKjs0bXKDfD8QSdCFtQXAnZngVwFyopSChipXWIOniNmPnRQDn/jbCjZJYwkqwi2IQVv26qQdklWra9q3Uhlv9hZ0k2TJIrdxL2hWzrfWacTSRq2A3sZrC+YfNoKhNhMSdCaZxb/UbFznRYFDsbCoXFfpPYbi8dsOJ3m2tW2HW/ziSGtGsNYwCb7aR9enZDjsnOsWIdpo23rj4dwywXYB3YWV9olsHyp7Lbfp0E4zoRdpGc7r/BbjxgRYcF+5g9Hnr22B+tntdsjcHfEEOcrQA63vZbacDKrn3EEIzeZKCQV1LMsvbaqEMEVBUzKqdDawBkNrFGUefmjMz/iiq9ZKYXqFeolQWgFFuBcW/YqHiL07mg0boAGC2p0Fk3FBTLXbKxDsdRrFjD8rE2SSwb2SK463PgzRz07HxhEhYLU7Kzk2k2orriMF6vyiuY5SUsQzLee8yad5WVEuD+neOErfGO9W3YUx34yBvOZhV5ZV3s/UbjPtlZxEDreN79xU46XbPTT5MPsLO7p3tT2Fma6Ev7RCDUAxkzl/CVU22duWy0W1Aoj1Ncv53qUAyNNRZTdyyDs6ZYe9RfGjtH6zMWD1D2x1DEq0W5Lb++T9F2MVboRdB9LmBWFatQeY86WHneCGI1Sy1L+xsWGSFQeU9ETyYbWxE0u36AbXv9E9iqR5xkorIOfrs6Vmz4fyjJ0M22fUSzaoF2DQjaBkNbjdZeM0oBKFcU7RmtqmFhyxTdWZKXxBHrYNvbz2SdXNKJpVl2wZavH8bmfuK3vrB3L4mVffkD", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Task " = _t, #"Start Time " = _t, #"End Time " = _t, #"Duration " = _t, #"Start Day" = _t]),
#"Added Index" = Table.AddIndexColumn(Source, "Index", 1, 1, Int64.Type),
#"Changed Type" = Table.TransformColumnTypes(#"Added Index",{{"Task ", type text}, {"Start Time ", type time}, {"End Time ", type time}, {"Duration ", type time}, {"Start Day", type text}}),
#"Inserted Time Subtraction" = Table.AddColumn(#"Changed Type", "Subtraction", each [#"End Time "] - [#"Start Time "], type duration),
#"Added Custom" = Table.AddColumn(#"Inserted Time Subtraction", "Custom", each let x = Duration.TotalMinutes([Subtraction]),
y = if x<0 then x*-1 else x in y),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom.1", each List.Times([#"Start Time "],[Custom],#duration(0,0,1,0))),
#"Expanded Custom.1" = Table.ExpandListColumn(#"Added Custom1", "Custom.1"),
#"Changed Type1" = Table.TransformColumnTypes(#"Expanded Custom.1",{{"Custom.1", type time}}),
#"Inserted Hour" = Table.AddColumn(#"Changed Type1", "Hour", each Time.Hour([Custom.1]), Int64.Type),
#"Grouped Rows" = Table.Group(#"Inserted Hour", {"Index", "Hour"}, {{"min", each List.Min([Custom.1]), type nullable time}, {"max", each List.Max([Custom.1]), type nullable time}}),
#"Added Custom2" = Table.AddColumn(#"Grouped Rows", "Custom", each Duration.TotalMinutes([max] - [min])+1),
#"Merged Queries" = Table.NestedJoin(#"Added Index", {"Index"}, #"Added Custom2", {"Index"}, "Added Custom2", JoinKind.LeftOuter),
#"Expanded Added Custom2" = Table.ExpandTableColumn(#"Merged Queries", "Added Custom2", {"Hour", "Custom"}, {"Hour", "Custom"}),
#"Removed Other Columns" = Table.SelectColumns(#"Expanded Added Custom2",{"Task ", "Hour", "Custom", "Start Day"}),
#"Renamed Columns" = Table.RenameColumns(#"Removed Other Columns",{{"Custom", "MinsInHours"}}),
#"Changed Type2" = Table.TransformColumnTypes(#"Renamed Columns",{{"MinsInHours", Int64.Type}})
in
#"Changed Type2"
Edit
The same code will work with whatever row gets added
From here
To
Related
I would like to know how to create the last column, Audit. To determine whether it is Included or Not Included the sum of any rows in "Average meeting per Day" within the same Employee/Day should match the "Actual Meeting" the employee attended.
I've taken this as an Example dataset -
Further, use Group By and Conditional column to have the Audit added.
Group by -
Conditional Column -
Result -
Code -
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8s3PS0msVNJRMgRiAz1TMGkEJBOVYnVwSBtjShuBJQzhZBJYOqQ0tRhZuwlcHqg9=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Day = _t, Emp_ID = _t, #"Actual Meeting" = _t, #"Average Meeting/Day" = _t, Emp_Name = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Day", type text}, {"Emp_ID", Int64.Type}, {"Actual Meeting", type number}, {"Average Meeting/Day", type number}, {"Emp_Name", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Day", "Emp_ID"}, {{"Sum of avg", each List.Sum([#"Average Meeting/Day"]), type nullable number}, {"Actual Meeting", each List.Min([Actual Meeting]), type nullable number}}),
#"Added Conditional Column" = Table.AddColumn(#"Grouped Rows", "Audit", each if [Actual Meeting] = [Sum of avg] then "Included" else "Not Included")
in
#"Added Conditional Column"
Not sure this is going to help, but here goes. Note: not set up to work with duplicate values among the potential items to analyze. No idea if it will work with so many decimals, so that the sum of the decimals might be 0.0000001 off from total and thus not be recognized. Works for me with whole numbers
let
Process=(x as table) as table =>
// Bill Szysz 2017, all combinations of items in list, blows up with too many items to process due to large number of combinations
let ComboList=x[AMD],
find=x[AM]{0},
Source=Table.FromList(List.Transform(ComboList, each Text.From(_))),
AddIndex = Table.AddIndexColumn(Source, "Index", 0, 1),
ReverseIndeks = Table.AddIndexColumn(AddIndex, "RevIdx", Table.RowCount(AddIndex), -1),
Lists = Table.AddColumn(ReverseIndeks, "lists", each
List.Repeat(
List.Combine({
List.Repeat({[Column1]}, Number.Power(2,[RevIdx]-1)),
List.Repeat( {null}, Number.Power(2,[RevIdx]-1))
})
, Number.Power(2, [Index]))
),
ResultTable = Table.FromColumns(Lists[lists]),
#"Replaced Value" = Table.ReplaceValue(ResultTable,null,"0",Replacer.ReplaceValue,Table.ColumnNames(ResultTable )),
#"Added Index" = Table.AddIndexColumn(#"Replaced Value", "Index", 0, 1, Int64.Type),
totals = Table.AddColumn(#"Added Index", "Custom", each List.Sum(List.Transform(Record.ToList( Table.SelectColumns(#"Added Index",Table.ColumnNames(ResultTable )){[Index]}) , each Number.From(_)))),
#"Filtered Rows" = Table.SelectRows(totals, each ([Custom] = find)),
#"Kept First Rows" = Table.FirstN(#"Filtered Rows",1),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Kept First Rows", {"Custom", "Index"}, "Attribute", "Value"),
#"Filtered Rows1" = Table.SelectRows(#"Unpivoted Other Columns", each ([Value] <> "0")),
#"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows1",{"Value"}),
FoundList = Table.TransformColumnTypes(#"Removed Other Columns",{{"Value", type number}}),
#"Merged Queries" = Table.NestedJoin(x, {"AMD"}, FoundList, {"Value"}, "output1", JoinKind.LeftOuter),
#"Expanded output1" = Table.ExpandTableColumn(#"Merged Queries", "output1", {"Value"}, {"Value"}),
#"Calculated Absolute Value" = Table.TransformColumns(#"Expanded output1",{{"Value", each if _=null then "Not Included" else "Included", type text}})
in #"Calculated Absolute Value",
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Day", type text}, {"Employee_ID", Int64.Type}, {"AM", Int64.Type}, {"AMD", Int64.Type}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Day", "Employee_ID"}, {{"data", each _, type table [Day=nullable text, Employee_ID=nullable number, AM=nullable number, AMD=nullable number]}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Process([data])),
#"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"Custom"}),
#"Expanded Custom" = Table.ExpandTableColumn(#"Removed Other Columns", "Custom", {"Day", "Employee_ID", "AM", "AMD", "Value"}, {"Day", "Employee_ID", "AM", "AMD", "Value"})
in
#"Expanded Custom"
I have a table for GL transactions for a whole period over the years. Now I need to develop a table in which I can see the opening balance and closing balance for each month.
Ex :
enter image description here
result I need is,
enter image description here
I tried "closingbalancemonth" function, but it gives the total of transactions done on the last day of the month as the closing balance.
this is not exactly what you want but at least it gives correct results.
Closing Balance
Closing Balance =
CALCULATE(sum(Transactions[GL Transactions]),
filter(all(Transactions),
EOMONTH(min(Transactions[date]),0)>Transactions[date]))
Opening Balance
Opening Balance =
CALCULATE(sum(Transactions[GL Transactions]),
filter(all(Transactions),
EOMONTH(min(Transactions[date]),-1)>Transactions[date]))
there are also two more calculated columns. one is for the report and one is for sorting..
for the report :
Year & Month = FORMAT(Transactions[date],"MMM - YY")
for sorting :
YearMonth = year(Transactions[date])&MONTH(Transactions[date])
see also the attached sample file
You can also try this which has been solved on the Power Query side...
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bY3BCcAwDAN38TsRioObdJbg/dcoFAwq9GfuJPkcG7RmAww4/b1p2YqHiB4iNniVcG3cIvpna4Hr78kU7pJ3cBeflvkA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"GL account" = _t, date = _t, #"GL Transactions" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"date", type date}, {"GL Transactions", type number}}),
#"Sorted Rows" = Table.Sort(#"Changed Type",{{"date", Order.Ascending}}),
#"Added Custom1" = Table.AddColumn(#"Sorted Rows", "Eomonth", each Date.EndOfMonth([date])),
#"Grouped Rows" = Table.Group(#"Added Custom1", {"GL account", "Eomonth"}, {{"Sum GL Transactions", each List.Sum([GL Transactions]), type nullable number}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "Closing Balance", each Function.Invoke((current as date,tb as table)=>
List.Sum(Table.SelectRows(tb,each [Eomonth]>= List.Min(#"Grouped Rows"[Eomonth]) and [Eomonth]<=current)[Sum GL Transactions])
,{[Eomonth],#"Grouped Rows"})),
#"Added Custom2" = Table.AddColumn(#"Added Custom", "Opening Balance", each Function.Invoke((current as date,tb as table)=>
List.Sum(Table.SelectRows(tb,each [Eomonth]<current)[Sum GL Transactions])
,{[Eomonth],#"Grouped Rows"})),
#"Changed Type1" = Table.TransformColumnTypes(#"Added Custom2",{{"Closing Balance", type number}, {"Opening Balance", type number}, {"Eomonth", type date}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"Sum GL Transactions"}),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Removed Columns", {"GL account", "Eomonth"}, "Attribute", "Value")
in
#"Unpivoted Columns"
--->
New Version
Hello I need help removing duplicate rows under certain conditions.
Raw File
ANI
Date
Time
111-111-1111
8/7/2022
10:34:00 AM
111-111-1111
8/7/2022
12:00:00 PM
111-111-1111
8/7/2022
12:03:00 PM
222-222-2222
8/8/2022
10:50:00 AM
222-222-2222
8/8/2022
10:52:10 AM
333-333-3333
8/9/2022
12:29:00 PM
333-333-3333
8/9/2022
12:32:00 PM
333-333-3333
8/9/2022
12:33:00 PM
444-444-4444
8/10/2022
1:50:00 PM
444-444-4444
8/10/2022
1:51:00 PM
Raw File contains ANI column which shows different phone numbers called into my system,
Date and Time columns matching the time which the calls came in.
I want to remove the earliest entries of the back-to-back calls based on the same number and date only if called in within 3 minutes after the initial call.
This is the end result that I wish to my Power BI would see and count:
Result
ANI
Date
Time
111-111-1111
8/7/2022
10:34:00 AM
111-111-1111
8/7/2022
12:03:00 PM
222-222-2222
8/8/2022
10:52:10 AM
333-333-3333
8/9/2022
12:33:00 PM
444-444-4444
8/10/2022
1:51:00 PM
At the end, I want it to count the back-to-back calls just once if called in within 3 min time frame and leave alone singular calls made outside of that condition.
Please help.
Here is another way of doing this using the Query Editor:See the comments to help understand the algorithm
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("jc8xCoAwDIXhq0hni8lLRO3mAQT30vtfw1qiZCodfsjwwSM5B2aOFoc57Mu2gIB6MiXRRDSdVyhzV6KyV94jUpwEEC00ubv1ldx6XyLxL0UkWtLk4dZxuPWuFAxL/5GqRkubZPqpfTQk+ZPlAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ANI = _t, Date = _t, Time = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"ANI", type text}, {"Date", type date}, {"Time", type time}}),
//create a column with the combine datetime
#"Added Custom" = Table.AddColumn(#"Changed Type", "DateTime", each [Date]&[Time], type datetime),
//group by ANI
// for each ANI group
// Sort by datetime
// Add a shifted column to compare one row to the next
// Retain only those rows where the difference between the original and the next column is greater than 3 minutes
// or the last row which will have a null in the shifted column
#"Grouped Rows" = Table.Group(#"Added Custom", {"ANI"}, {
{"Filtered", (t)=>
let
sorted = Table.Sort(t,{"DateTime", Order.Ascending}),
shifted = Table.FromColumns(
Table.ToColumns(t) & {List.RemoveFirstN(t[DateTime],1) & {null}},
type table[ANI=text, Date=date, Time=time, DateTime=datetime, Shifted=datetime]),
deleteRows = Table.SelectRows(shifted, each [Shifted] = null or Duration.TotalMinutes([Shifted] - [DateTime]) > 3)
in
deleteRows, type table[ANI=text, Date=date, Time=time]}
}),
//re-expand the groups
#"Expanded Filtered" = Table.ExpandTableColumn(#"Grouped Rows", "Filtered", {"Date", "Time"})
in
#"Expanded Filtered"
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("lc8xCoAwDIXhq0hnS5OXiNrNAwju4v2voaVRs1WHHzJ8w8u+B2aOFnehD1MaEwgoN1MWzUTdsoajb1hcsNjtmxVnAUQL1U5+w0BuQ8si82NFJFpS7ew3YHYbGlbww/rfVDVaWi3Ti+23j5Zve5w=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ANI = _t, Date = _t, Time = _t]),
#"Merged Columns" = Table.CombineColumns(Source,{"Date", "Time"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"Merged"),
#"Changed Type with Locale" = Table.TransformColumnTypes(#"Merged Columns", {{"Merged", type datetime}}, "en-US"),
#"Sorted Rows" = Table.Sort(#"Changed Type with Locale",{{"ANI", Order.Ascending}, {"Merged", Order.Descending}}),
#"Added Index" = Table.AddIndexColumn(#"Sorted Rows", "Index", 0, 1, Int64.Type),
#"Added Custom" = Table.AddColumn(#"Added Index", "Custom", each
try
if [ANI] = #"Sorted Rows"[ANI]{[Index] - 1} and #"Sorted Rows"[Merged]{[Index] - 1} -[Merged] <= #duration(0,0,3,0) then true else false
otherwise false
),
#"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([Custom] = false)),
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Index", "Custom"}),
#"Inserted Date" = Table.AddColumn(#"Removed Columns", "Date", each DateTime.Date([Merged]), type date),
#"Inserted Time" = Table.AddColumn(#"Inserted Date", "Time", each DateTime.Time([Merged]), type time),
#"Removed Columns1" = Table.RemoveColumns(#"Inserted Time",{"Merged"})
in
#"Removed Columns1"
This is how my table looks like in Power Query:
For each combination of date and Customer No (No), I need to calculate the sum of Value for the last 365 days.
I need this in Power Query, I know I could do it with DAX.
Are you looking for a 365 day total as of each and every date in the table? If so, then this seems to work
let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"No", Int64.Type}, {"Value", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type" ,"RunningTotal",(i)=>List.Sum(Table.SelectRows(#"Changed Type" , each [No]=i[No] and [Date]>Date.AddDays(i[Date],-365) and [Date]<=i[Date] ) [Value]), type number )
in #"Added Custom"
Or, 365 days before a specific date like 1980/12/31?
let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
MaxDate = #date(1980,12,31),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"No", Int64.Type}, {"Value", Int64.Type}}),
#"Filtered Rows" = Table.SelectRows(#"Changed Type", each [Date] <= MaxDate and [Date] > Date.AddDays(MaxDate,-365)),
#"Grouped Rows" = Table.Group(#"Filtered Rows", {"No"}, {{"Total", each List.Sum([Value]), type number}})
in #"Grouped Rows"
i am trying to get quarter from date ..
i tried this query
let
Source = "",
Custom1 = Source,
Custom2 = Calendar2,
Custom3 = let
Source = List.Dates(#date(1996, 1, 1), 500, #duration(1, 0, 0, 0)),#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Date"}}),
#"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"Date", type date}}),StartDate = #date(2016, 1, 1),
Today = DateTime.Date(DateTime.LocalNow()),
Length = Duration.Days(Today - StartDate),
Custom1 = #"Changed Type",
#"Inserted Year" = Table.AddColumn(Custom1, "Fin Year", each Date.Year([Date]+#duration(184,0,0,0)), Int64.Type),
#"Inserted Month Name" = Table.AddColumn(#"Inserted Year", "Month Name", each Date.MonthName([Date]), type text),
#"Inserted Day Name" = Table.AddColumn(#"Inserted Month Name", "Day Name", each Date.DayOfWeekName([Date]), type text),
#"Inserted Quarter of Year"= Table.AddColumn(#"Inserted Quarter of Year","Quarter of Year",each Date.QuarterOfYear([Date]),Int64.Type),
#"Inserted Month" = Table.AddColumn(#"Inserted Day Name", "Fin Month", each if Date.Month([Date]) >=7 then Date.Month([Date])-6 else Date.Month([Date])+6 , Int64.Type),
#"Inserted Day of Week" = Table.AddColumn(#"Inserted Month", "Day of Week", each Date.DayOfWeek([Date])+1, Int64.Type),
#"Inserted First Characters" = Table.AddColumn(#"Inserted Day of Week", "MMM", each Text.Start([Month Name], 3), type text),
#"Inserted First Characters1" = Table.AddColumn(#"Inserted First Characters", "DDD", each Text.Start([Day Name], 3), type text),
#"Reordered Columns" = Table.ReorderColumns(#"Inserted First Characters1",{"Date", "Fin Year", "Month Name", "MMM", "Fin Month", "Day Name", "DDD", "Day of Week"}),
#"Added Custom" = Table.AddColumn(#"Reordered Columns", "YYMM", each ([Fin Year]-2000)*100 + [Fin Month]),
#"Changed Type1" = Table.TransformColumnTypes(#"Added Custom",{{"YYMM", Int64.Type}}),
#"Added Custom1" = Table.AddColumn(#"Changed Type1", "MonthID", each (Date.Year([Date]) - Date.Year(StartDate))*12 + Date.Month([Date])),
#"Changed Type2" = Table.TransformColumnTypes(#"Added Custom1",{{"MonthID", Int64.Type}})
in
#"Changed Type2"
in
Custom3
quarter line from above code
#"Inserted Quarter of Year"= Table.AddColumn(#"Inserted Quarter of Year","Quarter of Year",each Date.QuarterOfYear([Date]),Int64.Type),
when i tried this shows an error
Expression.Error: The name 'Inserted Quarter of Year' wasn't recognized. Make sure it's spelled correctly.
and also there is probelm when i rename "Fin Month " to only "Month" this shows also an error
how to resolve this
You have the syntax wrong and self referring to the column that you are trying to create, you need to reference the previous step.
Inserted Quarter of Year
#"Inserted Quarter of Year"= Table.AddColumn(#"Inserted Quarter of Year","Quarter of Year",each Date.QuarterOfYear([Date]),Int64.Type),
should be:
#"Inserted Quarter of Year"= Table.AddColumn(#"Inserted Day Name", "Quarter of Year",each Date.QuarterOfYear([Date]),Int64.Type)
Hope that helps