Forum Discussion
Expression.Error: 1 arguments were passed to a function which expects 0.
- 5 years ago
I was still having problems implementing some of the solutions proposed so I ended up generating the additional fields in excel and just started with a data source that had the fields already. Thanks everyone for trying to help me out. Hopefully after some time I will have a better grasp on Power Query vis-à-vis Power BI and can circle back to implement what you've suggested here.
Cheers!
Hi cathoms
Here's a sample Excel file with a table called Dates
The blue table on Sheet1 is the table named Dates.
This line loads that table from the current workbook
Source = Excel.CurrentWorkbook(){[Name="Dates"]}[Content],
To load the same Excel file into PBI use this query.
Download the PBIX file.
let
Quarters = {3,3,3,4,4,4,1,1,1,2,2,2},
Period = {7,8,9,10,11,12,1,2,3,4,5,6},
Source = Excel.Workbook(File.Contents("D:\temp\PQ Custom Fiscal Periods.xlsx"), null, true),
Dates_Table = Source{[Item="Dates",Kind="Table"]}[Data],
#"Changed Type" = Table.TransformColumnTypes(Dates_Table,{{"Date", type date}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Fiscal Year", each if Date.Month([Date])>6 then Date.Year([Date])+1 else Date.Year([Date])),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Fiscal Quarter", each Quarters{Date.Month([Date])-1}),
#"Added Custom2" = Table.AddColumn(#"Added Custom1", "Fiscal Period", each Period{Date.Month([Date])-1})
in
#"Added Custom2"
You'll see that these 2 lines load the file and then the Dates table
Source = Excel.Workbook(File.Contents("D:\temp\PQ Custom Fiscal Periods.xlsx"), null, true),
Dates_Table = Source{[Item="Dates",Kind="Table"]}[Data],
Phil
If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.
- cathoms5 years agoResponsive Resident
I was still having problems implementing some of the solutions proposed so I ended up generating the additional fields in excel and just started with a data source that had the fields already. Thanks everyone for trying to help me out. Hopefully after some time I will have a better grasp on Power Query vis-à-vis Power BI and can circle back to implement what you've suggested here.
Cheers!