Forum Discussion
Group By for Salesforce Query
Hi,
I'm using a salesforce datasource and I wanted to do a group by over an object. This seems like a simple thing and it works fine in other sources, but in salesforce it doesn't. No matter what object I try, or group by option I try, the result is always empty, probably meaning an error some where (but there's no message to that).
Does anyone have any experience with such a case?
Thanks,
T
11 Replies
- Greg_Deckler
Community Champion
First, are you using the service, Excel or Power BI Desktop when connecting to your Sales Force instance?
- tamirkFrequent Visitor
Sorry about that...
I'm using Power BI Desktop
- Greg_Deckler
Community Champion
As a work-a-round, you can use the matrix visualization to group the data after you have loaded it, or create a new query to create a table just on the column you want to group by, remove duplicates, and then link the talbles together, you can then use that to group things in your visualizations.
- curth
Power BI Team
Can you post the text of the query you're trying (or send it privately, if you prefer it to remain private)?
- tamirkFrequent Visitor
Sure
let
Source = Salesforce.Data(),
Investment__c = Source{[Name="Investment__c"]}[Data],
#"Filtered Rows" = Table.SelectRows(Investment__c, each ([Status__c] <> "Cancelled")),
#"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows",{"Id", "Name", "Amount__c", "Total_Amount_Received__c", "Commitment__c"}),
#"Grouped Rows" = Table.Group(#"Removed Other Columns", {"Commitment__c"}, {{"Count", each Table.RowCount(_), type number}})
in
#"Grouped Rows"