FIX: "Duplicate names are not allowed" error when you add multiple filters to the Power View report in SharePoint 2013

Symptoms

Assume that you use Power View in Microsoft SharePoint 2013, and the SQL Server version is SQL Server 2012 service pack 2 (SP2) or SQL Server 2014. When you try to add multiple filters to a Power View report, you receive the following error message:
System.ArgumentException: The name '<Filter Name>' was specified twice, at index 0 and index 1. Duplicate names are not allowed.
Parameter name: keys[1]
at Microsoft.Data.Common.CommandTrees.ExpressionBuilder.Internal.EnumerableValidator`3.Validate(IEnumerable`1 argument, String argumentName, Int32 expectedElementCount, Boolean allowEmpty, Func`3 map, Func`2 collect, Func`3 deriveName)
at Microsoft.Data.Common.CommandTrees.ExpressionBuilder.Internal.EnumerableValidator`3.Validate()
at Microsoft.Data.Common.CommandTrees.ExpressionBuilder.Internal.ArgumentValidation.ValidateGroupBy(DbGroupExpressionBinding input, IEnumerable`1 keys, IEnumerable`1 aggregates, DbExpressionList& validKeys, ReadOnlyCollection`1& validAggregates)
at Microsoft.Reporting.QueryDesign.ExpressionTrees.ExpressionBuilder.Internal.QueryExpressionBuilder.GroupBy(QueryGroupExpressionBinding input, IEnumerable`1 groupItems, IEnumerable`1 aggregates)
at Microsoft.Reporting.QueryDesign.QueryDefinitionModel.Internal.QdmExpressionBuilder.QdmGroupBy(IEnumerable`1 expressions)
at Microsoft.Reporting.QueryDesign.QueryDefinitionModel.Internal.QdmExpressionBuilder.QdmFilter(IGrouping`2 predicates)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Microsoft.Reporting.QueryDesign.QueryDefinitionModel.Internal.QdmExpressionBuilder.QdmFilters(IEnumerable`1 filterConditions)
at Microsoft.Reporting.QueryDesign.QueryDefinitionModel.Internal.FilterQueryFactory.AddRowCount(QueryBuilder queryBuilder, Group group, EntitySet entity, IEnumerable`1 rowCountFilterContext)
at Microsoft.Reporting.QueryDesign.QueryDefinitionModel.Internal.FilterQueryFactory.CreateValueWithCountQuery(QueryBuilder queryBuilder, List`1 columns, IEdmFieldInstance fieldInstance, FilterCondition availableValueFilter, FilterCondition activeValueRetentionFilter, GroupReference& groupRef)
at Microsoft.Reporting.QueryDesign.QueryDefinitionModel.Internal.FilterQueryFactory.CreateValueListQuery(EntityDataModel model, IEdmFieldInstance fieldInstance, Int32 topCount, FilterCondition availableValueFilter, FilterCondition activeValueRetentionFilter, IEnumerable`1 exclusionPathSegments, ValueListQuerySchema& schema)
at Microsoft.Reporting.AdHoc.DataStructureManagement.Filtering.Internal.FilterValueQueryFactory.CreateFilterValuesQuery[TFilterMode](TFilterMode filterMode, Int32 maxRowCount, FormulaFilterCondition availableValueFilter, FormulaFilterCondition activeValueRetentionFilter, ValueListQuerySchema& schema)
at Microsoft.Reporting.AdHoc.DataStructureManagement.Filtering.Internal.ListFilterMode.ListDataLoader.<LoadDataImpl>d__15.MoveNext()
at Microsoft.Reporting.AsyncEnumerator.AsyncEnumeratorBase.MoveNextChecked()
at Microsoft.Reporting.AsyncEnumerator.AsyncEnumeratorBase.ResumeIterator(Boolean synchronous)
at Microsoft.Reporting.AsyncEnumerator.AsyncEnumeratorBase.BeginExecuteCore(IEnumerator`1 asyncMethod)
at Microsoft.Reporting.AsyncEnumerator.AsyncEnumeratorImpl.BeginExecute(Func`2 asyncMethod)
at Microsoft.Reporting.AsyncEnumerator.BeginExecute(Func`2 asyncMethod, AsyncCallback userCallback, Object userState, AsyncEnumeratorSettings settings)
at Microsoft.Reporting.AdHoc.DataStructureManagement.Filtering.Internal.FilterMode.DataLoader`1.BeginLoadData(AsyncCallback userCallback, Object userState)
at Microsoft.Reporting.AdHoc.DataStructureManagement.Filtering.Internal.FilterMode.DataLoader`1.LoadDataAsync()
at Microsoft.Reporting.AdHoc.DataStructureManagement.Filtering.Internal.FieldFilter.LoadDataAsyncCore()
at Microsoft.Reporting.AdHoc.DataStructureManagement.Filtering.Internal.FilterManager.OnEditCompleted()
at Microsoft.Reporting.AdHoc.DataStructureManagement.Filtering.Internal.PageFilterManager.OnEditCompleted()
at Microsoft.Reporting.AdHoc.DataStructureManagement.Filtering.Internal.FilterManager.OnEditCompleted(EventArgs args)
at Microsoft.Practices.Prism.Events.EventSubscription`1.InvokeAction(Action`1 action, TPayload argument)
at Microsoft.Practices.Prism.Events.EventSubscription`1.<>c__DisplayClass2.<GetExecutionStrategy>b__0(Object[] arguments)
at Microsoft.Practices.Prism.Events.EventBase.InternalPublish(Object[] arguments)
at Microsoft.Practices.Prism.Events.CompositePresentationEvent`1.Publish(TPayload payload)
at Microsoft.Reporting.AdHoc.DataStructureManagement.Internal.TransactionManager.EditEventAggregator.Exit()
at Microsoft.Reporting.AdHoc.DataStructureManagement.Internal.TransactionManager.EditEventAggregator.SelectionManager_SelectionResumed(Object sender, EventArgs e)
at Microsoft.Reporting.Util.RaiseEvent(EventHandler eventHandler, Object sender, EventArgs eventArgs)
at Microsoft.Reporting.AdHoc.Shell.Regions.Canvas.Internal.SelectionManager.ResumeSelectionChanges()
at Microsoft.Reporting.AdHoc.Shell.Regions.Canvas.Internal.SelectionManager.<.ctor>b__3(Object s, EventArgs e)
at Microsoft.Reporting.Util.RaiseEvent(EventHandler eventHandler, Object sender, EventArgs eventArgs)
at Microsoft.Reporting.AdHoc.DataManagement.Internal.DataManager.set_HandleRdmChanges(Boolean value)
at Microsoft.Reporting.AdHoc.DataManagement.Internal.DataManager.UndoManager_SuspendRdmHandlingChanged(Object sender, StateChangedEventArgs`1 args)
at Microsoft.Reporting.Util.RaiseEvent[TEventArgs](EventHandler`1 eventHandler, Object sender, TEventArgs eventArgs)
at Microsoft.Reporting.AdHoc.Shell.Services.UndoManagement.Internal.UndoManager.<.ctor>b__0(Object sender, StateChangedEventArgs`1 args)
at Microsoft.Reporting.Util.RaiseEvent[TEventArgs](EventHandler`1 eventHandler, Object sender, TEventArgs eventArgs)
at Microsoft.Reporting.AdHoc.Shell.Services.UndoManagement.Internal.UndoManagerApiProperties.set_SuspendDataManagerRdmHandling(Boolean value)
at Microsoft.Reporting.AdHoc.Shell.Services.UndoManagement.Internal.UndoManagerHasOpenUndoGroupStateImpl.OnUndoGroupCommitting(UndoGroup undoGroup)
at Microsoft.Reporting.AdHoc.Shell.Services.UndoManagement.Internal.UndoManagerHasOpenUndoGroupStateImpl.HandleUndoGroupStateChanged(Object sender, EventArgs args)
at Microsoft.Reporting.Util.RaiseEvent(EventHandler eventHandler, Object sender, EventArgs eventArgs)
at Microsoft.Reporting.AdHoc.Shell.Services.UndoManagement.Internal.UndoGroup.HandleStateEnteredEvent(Object sender, EventArgs args)
at Microsoft.Reporting.Util.RaiseEvent(EventHandler eventHandler, Object sender, EventArgs eventArgs)
at Microsoft.Reporting.AdHoc.Shell.Services.UndoManagement.Internal.UndoGroupCommittingStateImpl.EnterState()
at Microsoft.Reporting.AdHoc.Shell.Services.UndoManagement.Internal.UndoGroup.SetState(UndoGroupStateImpl nextState)
at Microsoft.Reporting.AdHoc.Shell.Services.UndoManagement.Internal.UndoGroupOpenStateImpl.Commit()
at Microsoft.Reporting.AdHoc.Shell.Services.UndoManagement.Internal.UndoGroup.Commit()
at Microsoft.Reporting.AdHoc.DataStructureManagement.Internal.TransactionManager.CompleteTransaction(Transaction transaction, Boolean completedSuccessfully)
at Microsoft.Reporting.AdHoc.DataStructureManagement.Internal.TransactionManager.Transaction.Dispose()
at Microsoft.Reporting.AdHoc.DataStructureManagement.Filtering.Internal.ListFilterMode.SelectOnly(ListFilterRow row)
at Microsoft.Reporting.AdHoc.Shell.Regions.Canvas.Internal.FilterCheckBoxList.FieldValueSelectorButton_Click(Object sender, RoutedEventArgs e)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)

Resolution

This issue was first fixed in the following cumulative update of SQL Server.

Cumulative Update 1 for SQL Server 2014 SP1

Cumulative Update 6 for SQL Server 2014

Cumulative Update 4 for SQL Server 2012 SP2

About cumulative updates for SQL Server

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
Properties

Article ID: 3019110 - Last Review: Jun 22, 2015 - Revision: 1

Feedback