# Filtered grid row total amount (footer)

**URL:** <https://forum.radzen.com/t/filtered-grid-row-total-amount-footer/4822>\
**Category:** Blazor Server\
**Created:** [September 2, 2020, 11:17am UTC](https://forum.radzen.com/t/filtered-grid-row-total-amount-footer/4822 "2020-09-02T11:17:24Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Foizman](https://forum.radzen.com/letter_avatar_proxy/v4/letter/f/9dc877/32.png) [@Foizman](https://forum.radzen.com/u/Foizman)\
**Post date:** [September 2, 2020, 11:17am UTC](https://forum.radzen.com/t/filtered-grid-row-total-amount-footer/4822/1 "2020-09-02T11:17:24Z")

</div>

When we filter a grid, it doesn't show the filtered amount in the footer (e.g. sum of the remaining five elements when filtering for 'Chevalier') but always to total unfiltered amount, so this component cannot be used in real-world scenarios in most cases.

see [Blazor DataGrid - Footer Totals | Free UI Components by Radzen](https://blazor.radzen.com/datagrid-footer-totals)

 ![image](https://forum.radzen.com/uploads/default/original/2X/7/79ebd51d8ca5e4212678142c52cf84e850e0c433.jpeg)

Any idea how to achive that?

Cheers,  
Volker

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [September 2, 2020, 11:31am UTC](https://forum.radzen.com/t/filtered-grid-row-total-amount-footer/4822/2 "2020-09-02T11:31:12Z")

</div>

You can use `View` similar to first column to sum only filtered data only.

---

<div class="post-metadata">

**Author:** ![Foizman](https://forum.radzen.com/letter_avatar_proxy/v4/letter/f/9dc877/32.png) [@Foizman](https://forum.radzen.com/u/Foizman)\
**Post date:** [September 2, 2020, 11:43am UTC](https://forum.radzen.com/t/filtered-grid-row-total-amount-footer/4822/3 "2020-09-02T11:43:26Z")

</div>

Please provide a code-snipped for the footer-template to achive this.

 ![image](https://forum.radzen.com/uploads/default/original/2X/6/6e899f12e947ae79848b2d6c51e81742ffcc3256.png)

THANK YOU, Vladimir!

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [September 2, 2020, 12:27pm UTC](https://forum.radzen.com/t/filtered-grid-row-total-amount-footer/4822/4 "2020-09-02T12:27:45Z")

</div>

Hey @Foizman,

Check my previous reply. If you are looking for dedicated support the options are here:

> **[Pricing](https://www.radzen.com/pricing/)**
>
> Purchase a commercial license of Radzen or download the free version.

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [September 2, 2020, 12:44pm UTC](https://forum.radzen.com/t/filtered-grid-row-total-amount-footer/4822/6 "2020-09-02T12:44:05Z")

</div>

@Foizman again check my previous reply. Check the source code of the first column footer where the `View` is used (filtered records) instead all data.

---

<div class="post-metadata">

**Author:** ![Foizman](https://forum.radzen.com/letter_avatar_proxy/v4/letter/f/9dc877/32.png) [@Foizman](https://forum.radzen.com/u/Foizman)\
**Post date:** [September 2, 2020, 12:47pm UTC](https://forum.radzen.com/t/filtered-grid-row-total-amount-footer/4822/7 "2020-09-02T12:47:40Z")

</div>

I'm talking about a one-line snippet of code and you want to sell a license. Well, that's what I call business-minded.

Thank you for the crucial point, was really easy 😄  
 ![image](https://forum.radzen.com/uploads/default/original/2X/e/e09767b758d188df13ae685cb10387f81e81daa2.png)

Be it as it may, thank you very much for the exceptionally good support from Radzen, **not joking!**

You do this in an exemplary manner, not to mention: Compared to Syncfusion & Co., your support is definitely benchmark and best practice!

Cheers,  
FM

---

<div class="post-metadata">

**Author:** ![Owais\_Raza](https://forum.radzen.com/user_avatar/forum.radzen.com/owais_raza/32/4054_2.png) [@Owais\_Raza](https://forum.radzen.com/u/Owais_Raza)\
**Post date:** [May 9, 2021, 1:50am UTC](https://forum.radzen.com/t/filtered-grid-row-total-amount-footer/4822/8 "2021-05-09T01:50:07Z")

</div>

Bother, You're my Brother!!!  
You Just Made my Day!!!!  
Love you From Pakistan , You Single Line of Code Sinpet Just helped me very Much...  
Sorry for RIP English, A Very Very Little Junior Programmer...  
BTW My Name is Owais, Love From PAKISTAN!!!!

---

<div class="post-metadata">

**Author:** ![Zlatomir\_Zhelev](https://forum.radzen.com/user_avatar/forum.radzen.com/zlatomir_zhelev/32/18403_2.png) [@Zlatomir\_Zhelev](https://forum.radzen.com/u/Zlatomir_Zhelev)\
**Post date:** [November 13, 2024, 6:56am UTC](https://forum.radzen.com/t/filtered-grid-row-total-amount-footer/4822/9 "2024-11-13T06:56:26Z")

</div>

In my blazor server .net8 app using  
grid0.View.Sum() in the datagrid  
causes "A second operation started on this context before a previous operation completed."  
Any thoughts, without being sarcastic like Foizman?

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [November 13, 2024, 7:00am UTC](https://forum.radzen.com/t/filtered-grid-row-total-amount-footer/4822/10 "2024-11-13T07:00:20Z")

</div>

> [@Zlatomir\_Zhelev](#):
>
> A second operation started on this context before a previous operation completed.

Try to use transient lifetime for the DbContext or ToList():

> <https://stackoverflow.com/questions/48767910/entity-framework-core-a-second-operation-started-on-this-context-before-a-previ>

---

<div class="post-metadata">

**Author:** ![Zlatomir\_Zhelev](https://forum.radzen.com/user_avatar/forum.radzen.com/zlatomir_zhelev/32/18403_2.png) [@Zlatomir\_Zhelev](https://forum.radzen.com/u/Zlatomir_Zhelev)\
**Post date:** [November 13, 2024, 7:25am UTC](https://forum.radzen.com/t/filtered-grid-row-total-amount-footer/4822/11 "2024-11-13T07:25:43Z")

</div>

Thank you, but the issue here was my desire to simplify. I had previously made some Get{Entity}ById() generic:

public async Task GetAccidentById(int id) =\> await GetByIdAsync(id, i =\> i.AccidentKind, i =\> i.Machinery);

private async Task GetByIdAsync(int id, params Expression\<Func\<T, object\>\> includes) where T : class, IIdentifiable  
{  
var items = Context.Set()  
.AsNoTracking()  
.Where(e =\> e.Id == id);  
foreach (var include in includes)  
items = items.Include(include);  
var itemToReturn = await items.FirstOrDefaultAsync();

```
return itemToReturn;

```

}

---

<div class="post-metadata">

**Author:** ![Zlatomir\_Zhelev](https://forum.radzen.com/user_avatar/forum.radzen.com/zlatomir_zhelev/32/18403_2.png) [@Zlatomir\_Zhelev](https://forum.radzen.com/u/Zlatomir_Zhelev)\
**Post date:** [June 3, 2025, 4:14am UTC](https://forum.radzen.com/t/filtered-grid-row-total-amount-footer/4822/12 "2025-06-03T04:14:19Z")

</div>

In an inline edit datagrid with grid.View.Sum(x=\>x.Amount) in the footer, if the grid is empty (has no records), the Add button does nothing. When I change it to sales.Sum(x=\>x.Amount) it is OK.

\<RadzenButton Text=Добави Click=AddButtonClick  
\<RadzenDataGrid @ref=grid Data=sales TItem=Sale Density=Density.Compact AllowFiltering=true AllowSorting=true ...  
@code  
{  
protected IEnumerable sales;  
...  
protected async Task AddButtonClick(MouseEventArgs args)  
{  
await grid.InsertRow(new Sale()  
{  
Start = DateTime.Now  
});  
}  
}

So instead of  
FooterTemplate\>@sales.Sum(i =\> i.Amount))

I have to use  
FooterTemplate\>@GetAmountSum()  
private double GetAmountSum()  
{  
if (sales.Count() == 0)  
return 0;  
else  
return grid.View.Sum(i =\> i.AmountRead);  
}
