SUM According To Group By On Expression formula

  • Hi, Please Help me!!!

    My dataset Query Result as below

    * I want to add on my Report only Text box (I donโ€™t want matrix or normal table) I need in textbox And I want to write "Expression formula in this text box"

    * I want to bring to Text box only SUM OF C Colum but according to B colum B colum = "YK" Therefore it should be the result = 300

    The Question is

    How Can I write this Expression formula?

    Please Help me , Otherwise I lose my job ๐Ÿ™

    Thanks in Advance .

  • Instead of handling this in report using expression, if you are not using this dataset anywhere in report then why don't you handle it on sql part only.

    Like writing query with group by and having clause or query with case when then statements.... If you still want to go for expression... try using iif, I'm not sure if it will work in your case... will try and let you know soon if it works...!

    :rolleyes:

  • Sacheen (10/21/2010)


    Instead of handling this in report using expression, if you are not using this dataset anywhere in report then why don't you handle it on sql part only.

    Assuming you're on SQL 2005 or greater...

    Add to you select :

    SELECT <existing columns>,

    Qty = SUM(<c column>) OVER (PARTITION BY <b column>)

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

  • I too would definitely do this in the dataset. If you can't work in the dataset, you could try producing a hidden column to add an appropriate row formula to and then add the ReportItems from that hidden column.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply