Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
Anonymous
Not applicable

error "arguments were passed to a function which expects 2"

Hi

Please help me

I subscribed to Cluster API on azure data marketplace,

I tried to "score" my columns for it to return cluster, the below is my M function. I used energy dataset.

My question is how do I pass 2 parameters in this statement?

#"Grouped Rows" = Table.Group(#"Changed Type1", {"YEAR", "k"}, {{"Data", each Score(_), type record}})

where each Score("this is the record", "this is K")

I tried each Score(_,"5") where 5 is k value but it doesnt like that 😞

Help plz

 

 

 

 

let
Source = Csv.Document(File.Contents("energy.csv"),[Delimiter=",", Columns=27, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"STATE", type text}, {"YEAR", Int64.Type}, {"GenTotal", type number}, {"GenHydro", type number}, {"GenSolar", type number}, {"GenTotalRenewable", type number}, {"GenSolarBinary", Int64.Type}, {"GenTotalRenewableBinary", Int64.Type}, {"AllSourcesCO2", type text}, {"AllSourcesSO2", type text}, {"AllSourcesNOx", type text}, {"EPriceResidential", type number}, {"EPriceCommercial", type number}, {"EPriceIndustrial", type number}, {"EPriceTransportation", type number}, {"EPriceTotal", type number}, {"EsalesResidential", type number}, {"EsalesCommercial", type number}, {"EsalesIndustrial", type number}, {"EsalesTransportation", type number}, {"EsalesOther", type text}, {"EsalesTotal", type number}, {"CumlFinancial", Int64.Type}, {"CumlRegulatory", Int64.Type}, {"Total.salary", type number}, {"presidential.results", Int64.Type}, {"Import", Int64.Type}}),
#"Removed Other Columns" = Table.SelectColumns(#"Changed Type",{"YEAR", "GenTotal"}),
#"Added Custom" = Table.AddColumn(#"Removed Other Columns", "k", each "5"),
#"Changed Type1" = Table.TransformColumnTypes(#"Added Custom",{{"k", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type1", {"YEAR", "k"}, {{"Data", each Score(_), type record}})
in
#"Grouped Rows"

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

 

Since I'm not clear your function, can you provide more detail information about the "Score" function or share me a sample file?

 

Do you want to get the below effect?

Capture3.PNG

 

If as I said, you can refer to below formula:

 

#"Grouped Rows" = Table.Group(#"Added Custom", {"Year", "k"}, {{"Data",each {_{0}[Year]&","&_{0}[k]},type record}})

  

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

Find out what's new and trending in the Fabric Community.