Forum Discussion
Salesforce Lead Object Issue
- 9 years ago
Ok, so it turns out there is an actual bug here. Anonymous hopefully you can create a ticket from this (I'm assuming you're MS given your username?).
For the benefit of the wider interwebs here's the bug, and work-around.
Recreation:
Datasource: SFDC Objects
Object: Anything with a datetime, date only can also be problematic in similar ways.
Transform: Date->Month (month number, fails for both add column or transform. others like year number fail too).
Boom: DataSource.Error: Non-grouped query that uses overall aggregate functions cannot also use LIMIT
This used to only be a problem on larger tables like Leads - hence the above post. Since at least 22/5/2017 this seems to affect even tiny tables with only a few rows. TRied with April both and May PBI Desktop releases. Something seems to have changed on SFDC side as both PBI releases gave same result but for smaller tables this DEFINITELY worked in April release, and pretty sure May too - as said, larger tables were always an issue but the below workaround works on even my largest tables.
Example broken query:
let
Source = Salesforce.Data(),
ForecastingQuota = Source{[Name="ForecastingQuota"]}[Data],
#"Extracted Month" = Table.TransformColumns(ForecastingQuota,{{"StartDate", Date.Month}})
in
#"Extracted Month"Workaround:
If you have a date only field, just add a new column that extracts the "date only", basically you end up with a duplicate column but you can then successfully extract the month successfully.
Working query:
let
Source = Salesforce.Data(),
ForecastingQuota = Source{[Name="ForecastingQuota"]}[Data],
#"Inserted Date" = Table.AddColumn(ForecastingQuota, "Date", each DateTime.Date([StartDate]), type date),
#"Inserted Month" = Table.AddColumn(#"Inserted Date", "Month", each Date.Month([Date]), type number)
in
#"Inserted Month"Hope that helps save somebody else 5 hours of debugging a heavily nested set of reports...
Quick update: if you have multiple columns you don't seem to need to make duplicates of them all - as soon as one column is "fixed" the Transform/Add column works for others.