locked
Is there a way to have a view give me a total for a column? RRS feed

  • Question

  • Hey everyone, 

    In CRM 4.0, is there anyway to have it give me a total somehow of a column?  For example, under opportunities, I have a view that shows all open opportunities, and one column is estimated revenue.  I pretty much need the sum of these columns daily, so I always have to export to excel.  Is there a way to even add a button or something so that I can highlight them and get the total?  Having the grand total would be great, but if I could even highlight ones using CTRL and then press a button to get a total it would be even better.  Just thought I'd check to see as it would be a huge help, thanks!

    Monday, June 14, 2010 1:36 PM

Answers

  • An easy solution would be to create a dynamic Excel worksheet from your export, then all you need to do is open the excel worksheet in the future and refresh the data to get your total.  You could also create a quick report and just run the report or schedule it for delivery to your e-mail account.


    Regards, Donna

            Windows Live Blog

    Monday, June 14, 2010 2:04 PM

All replies

  • This can't be done natively, but could definitely be possible with some custom code and a button.  You could have some javascript that totals up that column for every row selected. 
    Blake Scarlavai - http://mscrmdev.blogspot.com/ - Sonoma Partners - http://www.sonomapartners.com/
    Monday, June 14, 2010 1:54 PM
  • You canmake an ISV button for Opportunity in which you may detect selected items, retrieve value of needed field, make a calculation and show a message with the result. I can give you an article, where iteration through selected items is made for deleting Teams. You can just change SOAP request with what you need and add some logic. Refer to: http://a33ik.blogspot.com/2010/05/delete-teams-button-in-microsoft.html

    Stunnware Tools may help you in building request: http://www.stunnware.com/default.aspx?area=products&group=swtools4&subarea=swtools4-overview


    Oleksandr Klymenko,
    My Blog: www.darkaxe.wordpress.com
    Monday, June 14, 2010 1:58 PM
  • An easy solution would be to create a dynamic Excel worksheet from your export, then all you need to do is open the excel worksheet in the future and refresh the data to get your total.  You could also create a quick report and just run the report or schedule it for delivery to your e-mail account.


    Regards, Donna

            Windows Live Blog

    Monday, June 14, 2010 2:04 PM
  • If you have some development skills, you ought to be able to take this solution which provides a summary count of the records in a view and displays this through a dummy record row and adapt it to suit your needs:

    http://blogs.msdn.com/b/crm/archive/2010/04/05/record-counter-for-microsoft-dynamics-crm-4-0.aspx

    Monday, June 14, 2010 10:30 PM
  • I wrote some javascript that you could use for a button on your grid.  I wrote this for a default Opportunities grid and it totals up Est. Revenue for all the highlighted records.

    A few things to note.  record.childNodes[5] - the 5 here is the index of the column you want.  In this case 5 is the Est. Revenue column.  Next since I am using a money field I need to replace the dollar sign (.replace('$','')).  This won't be needed if you are just doing a normal number field.  Lastly, for some reason the value has some funky characters in it, therefore I escape the value and then replace those values so I can then parse the value into a float and total all the values.

     

    var selectedRecords = document.getElementById('crmGrid').InnerGrid.SelectedRecords;
    var totalRevenue = 0;
    for (var i = 0; i < selectedRecords.length; i++)
    {
        var record = selectedRecords[i][3];
        var revenue = record.childNodes[5].innerText.replace('$', '');
        var escapedRevenue = escape(revenue).replace('%u202D', '').replace('%u202C', '');
        totalRevenue += parseFloat(escapedRevenue);
    }
    alert(totalRevenue);

     

    Hope it helps.


    Blake Scarlavai - http://mscrmdev.blogspot.com/ - Sonoma Partners - http://www.sonomapartners.com/
    Wednesday, June 16, 2010 3:03 AM