Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I'm working on a formula, for a calculated table, that will group the following columns:
Player, Year, Month (all part of a table called Results)
I then want to provide a sum of the total points within each grouping - in other words how many points did every player get each month.
My attempted formula is below, however this doesn't work for the reason "Function GROUPBY expects a column name as argument number 5"
PointsPerMonth = GROUPBY(Results,[Player],Results[Year],Results[Month],SUMX(Results,SUM(Results[Points])))
Can anybody help please?
The formula worked with just the groupings, its the SUMX/SUM formulas that have created the error.
Solved! Go to Solution.
It is great you found another way. But check your formula out, you are not writting the NAME:
PointsPerMonth = GROUPBY(Results,[Player],Results[Year],Results[Month], "NAME", SUM(Results[Points]))
Regards,
Happy to help!
Hi @PetyrBaelish,
Have you solved your problem?
If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.
If you still need help, please share some data sample and your desired output so that we could help further on it.
Best Regards,
Cherry
Can you be more specific on what are you trying to do? for simple grouping you can just add a visualization like players and add the column points. The render will automatically group a SUM or what you want to agregate in the visualization by player o the category column you add on it. I am used to work with SUMMARIZE for grouping but it should be the same.
The error in GROUPBY is that you have to put a "Name" (string) to the agregation as argument before the SUM. Replace this SUMX(Results,SUM(Results[Points])) for SUM(Results[Points]) because your are just doing an innecesary iteration. For example:
Be carefull, this function returns a table not a value. I don't know if your objetive is to create a table or measure.
Regards,
Happy to help!
I'm trying to create a a Calculated Table here (not a measure or column).
I have tried using this formula instead, but receive the error "Function GROUPBY expects a column name as argument number 5."
PointsPerMonth = GROUPBY(Results,[Player],Results[Year],Results[Month],SUM(Results[Points]))
I have however tried a different approach to crating a calculated tabel, which was to create a measure as: SumPoints = SUMX(Results,[Points]) which has worked when adding this to a visualisation.
Thanks everyone for your help & suggestions.
It is great you found another way. But check your formula out, you are not writting the NAME:
PointsPerMonth = GROUPBY(Results,[Player],Results[Year],Results[Month], "NAME", SUM(Results[Points]))
Regards,
Happy to help!
Thanks for your response - my last post wasn't clear - in trying to do something else I created a calculated column called SumPoints using the formula above and used that instead of my calcualted table I was previously trying (looking back, I can't remember why I was going down the calculated table route in the first place).
Hi @PetyrBaelish,
It seems that you have solved your problem, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.
Best Regards,
Cherry
Hi,
Are you creating a calculated column?
Maybe this will work for you:
PointsPerMonth = SUMX(FILTER(Results, [Player] = EARLIER([Player]) && [Year] = EARLIER([Year]) && [Month] = EARLIER([Month])), [Points])
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |