SSRS countrow Aggregate error(Aggregate and lookup functions cannot be used in query parameter expressions.)

Below expression works fine with text box but gives error in dataset expression.
="SET FMTONLY OFF select  "+ join(Parameters!Column.Value,",") +" FROM pamcustom.dbo.vw_HFL_HFD_HotfileData INNER JOIN pamcustom.dbo.HFL_HFB_HotFileBatch  on BatchID = HFB_intBatchID where BatchID ="+Parameters!BatchId.Value+"
and "+Parameters!cmbTranType.Value+" "+ iif(CountRows("DS_Aml_Mnr_Iss_Desc")=Parameters!Mnr_Iss_Desc.count," "," and aml_mnr_iss_desc in "+"('" & join(Parameters!Mnr_Iss_Desc.Value,"','")
& "')")+iif(CountRows("ds_ReportingCategory")=Parameters!ReportingCategory.count," "," and ReportingCategory in "+"('" & join(Parameters!ReportingCategory.Value,"','") & "')")+iif(CountRows("ds_NAICSubGroup")=Parameters!NAICSubGroup.count,"
"," and naicsubgroup in "+"('" & join(Parameters!NAICSubGroup.Value,"','") & "')")+iif(CountRows("ds_PortTrading")=Parameters!PortTrading.count," "," and porttrading in "+"('"
& join(Parameters!PortTrading.Value,"','") & "')")+iif(CountRows("ds_GL_LE")=Parameters!GL_LE.count," "," and gl_le in "+"('" & join(Parameters!GL_LE.Value,"','") &
"')")+iif(CountRows("ds_coagroup")=Parameters!cmbCoaGrp.count," "," and coagroup in "+"('" & join(Parameters!cmbCoaGrp.Value,"','") & "')")+iif(CountRows("Portfolio")=Parameters!cmbPort.count,"
"," and portfolio in "+"('" & join(Parameters!cmbPort.Value,"','") & "')")+IIf(IsNothing(Parameters!txtSecID.Value)," "," and secid in ('"+Replace(Parameters!txtSecID.Value,",","','")+"')")+iif(IsNothing(Parameters!minPortFilter.Value)
and IsNothing(Parameters!MinPort.Value)," "," and portfolio "+Parameters!minPortFilter.Value+Parameters!MinPort.Value)+iif(IsNothing(Parameters!maxPortFilter.Value) and IsNothing(Parameters!MaxPort.Value)," ","
and portfolio "+Parameters!maxPortFilter.Value+Parameters!MaxPort.Value)+iif(IsNothing(Parameters!minCoaFilter.Value) and IsNothing(Parameters!txtMinCoa.Value)," "," and portfolio "+Parameters!minCoaFilter.Value+Parameters!txtMinCoa.Value)+iif(IsNothing(Parameters!maxCoaFilter.Value)
and IsNothing(Parameters!txtMaxCoa.Value)," "," and portfolio "+Parameters!maxCoaFilter.Value+Parameters!txtMaxCoa.Value)
I guess the error " Aggregate and lookup functions cannot be used in query parameter expressions." is because I am using CountRow to ensure that if all values of multi select all selected i will not use that filter in where clause.
Pls. guide...

Hi, Include your parameter total count in the dataset for parameter and instead of using countrows() function use the count from dataset in the expression.
Hope this helps.........
Ione

Similar Messages

  • Error : Old and new exceptions cannot be used at the same time.

    HI ALL,
    i build a new exception class with message class and i want to replace the
    old exception that i had in the method ,what i did is delete the exception from the method
    signature and add the exception class .
    the problem is that when i try to activate the method i get error :
    Old and new exceptions cannot be used at the same time.
    CALL FUNCTION 'CALCULATE_HASH_FOR_CHAR'
          EXPORTING
            alg            = 'MD5'
            data           = iv_iss
          IMPORTING
            hash           = lv_issu
          EXCEPTIONS
            unknown_alg    = 1
            param_error    = 2
            internal_error = 3
            OTHERS         = 4.
        IF sy-subrc <> 0.
          RAISE EXCEPTION TYPE cx_user_mng EXPORTING
          textid = cx_user_mng=>wrong_isrs.
        ENDIF.
    I want to use the new exception class ,
    how can i avoid this error ?
    Best Regards
    Edited by: Joy Stpr on Jul 22, 2009 2:56 PM
    Edited by: Joy Stpr on Jul 22, 2009 3:16 PM

    Hi Joy,
    Check this link.
    [Old and New Exceptions Cannot be used at same time|Urgent problem, give me a hand;
    Old and new exceptions cannot be used the same time, what does this mean???
    Regards,
    Lakshman.

  • Aggregate functions cannot be used in group expressions

    Hi have report showing sales by Vendor. I need to list all the vendors with Monthly Total>5000 and combine the rest as "OTHER VENDORS"
    Vendor is a Group in my report, so I tried to put an expression as a Group on:
    =IIF(Sum(Fields!Mth_1_Sales.Value)>5000,Fields!Vendor_No.Value,"OTHER VENDORS")
    I've got an error: "aggregate functions cannot be used in group expressions"
    How do I get Vendors with Sales < 5000 into  "OTHER VENDORS" ?

    Hi,
    You need to group by Month on group expression,
    And you can use the same expression in the report column as 
    =IIF(Sum(Fields!Mth_1_Sales.Value)>5000,Fields!Vendor_No.Value,"OTHER VENDORS")
    Many Thanks
    ..................................................................................................................................................................Please
    mark the post as Please mark the post as answered if this post helps to solve the post.

  • Differenct between Lookup Error Output and Lookup No Match Output

    Hi All
    I'm new in SSIS and reading book for SSIS and unable to understand the difference between Lookup Error Output and Lookup No Match Output in Lookup transformation. Are these terms same or is there any difference between them ?. Please guide
    Thanks
    Regards
    Muz

    Nope. Error output is more generic ie any errors happening inside lookup can be redirected to error output by default. This includes lookup match failures as well as data conversion error, truncation error etc. Upto SSIS 2005 this was the only output available
    in addition to match output inside lookup so if you want to capture unmatched rows you had to redirect them to error output itself.
    But from SSIS 2008 onwards they've introduced one more output called no match output. This gives you ability to redirect only no matched rows through no match output so that you'll be able to distinguish between unmatched rows and other error rows.
    You can configure this option inside Specify how to handle rows with no matching entries option in Lookup Editor. You can choose Ignore Failure,
    Redirect rows to no match output,Redirect rows to error output etc as options
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Wifi and bluetooth function cannot switch on

    My phone cannot switch on the bluetooth and wifi function. Already try restore factory setting. Still cannot on. My phone had drop before this but that time nothing happen just crack behind.. 2 month later just suddenly the bluetooth and wifi function cannot switch on at all.

    You should contact your local sony team:
    http://www.sonymobile.com/global-en/support/contact-us/
    All we have to decide is what to do with the time that is given to us - J.R.R. Tolkien

  • Please help, i connect my phone to computer and gives me error code this i phone cannot be used because the apple mobile device is not started

    please help, i connect my phone to computer and gives me error code this i phone cannot be used because the apple mobile device is not started

    http://support.apple.com/kb/HT1923
    uninstall and reinstall
    there is a complicated way to work with just the mobile device support but its simpler just to uninstall itunes and related components and then reinstall itunes
    ur music will be fine, u will just lose the playlists. but ur mobile device support will be working again.

  • After updating to iTunes 5, I got an error message said the iPhone cannot be used because the Apple Moble Device service is not started. Any idea why and how to fix this? Thanks!

    After updating to iTunes 5, I got an error message said the iPhone cannot be used because the Apple Moble Device service is not started. Any idea why and how to fix this? Thanks!

    Please follow this article:
    http://support.apple.com/kb/TS1567
    it should help
    let me know

  • HT4759 Please help me. My Apple id not be used in iCloud. After sign in, to iCloud, I have error massage: This Apple ID cannot be used to sign in to iCloud. Create a new Apple ID or sign in with a different one.

    Please help me. My Apple id not be used in iCloud. After sign in, to iCloud, I have error massage: This Apple ID cannot be used to sign in to iCloud. Create a new Apple ID or sign in with a different one.

    For whatever reasons, the "None" option is not always available to all users and I think it may be related to what country you live in. Short of contacting Apple to get it straightened out, if you haven't done anything with your new ID ye - you can create an Apple ID without a credit card and simply abandon the one that you just created.
    This explains how you can creaet an ID without a credit card.
    http://support.apple.com/kb/HT2534
    The two big things that you have to remember for this to work are ... you have to sign out of your existing Apple ID .... Settings>Store>Apple ID - tap the ID and sign out. Then you have to try to download a free app to bring up the window that asks you to sign in or create an ID. Read the information on the website that I referenced above.
    If you have not used the original Apple ID for anything yet, you can simply ignore it and use the new one - or like I said earlier - contact iTunes support and ask them to help you sort it out.
    Here is a link to iTunes support. You can change the country in the bottom right corner of the screen.
    http://www.apple.com/support/itunes/contact/

  • HT2589 ibooks still gives me the following error message "This Apple ID cannot be used for the iTunes Store."

    I've done all of the above suggested sign in methods, and yet ibooks gives me the following error message "This Apple ID cannot be used for the iTunes Store."

    Found this in the forums here, it works.
    "OK...I think I have found a solution.  In settings, select tunes &amp; app store.  click on Apple ID> View Apple ID>Payment Information. It appears it is not saving or requiring payment information to be updated. This worked for me."
    Thanks

  • I keep getting an error message saying "This iPod cannot be used because Apple Mobile Device service is not started"

    I keep getting an error message saying "This iPod cannot be used because Apple Mobile Device service is not started" and i have no idea what that means so any help will be much appreciated, i just want to add more of my music on it

    I got that message yesterday. I'm new at this so don't know if this is the correct solution but it worked for me. I reset my iPod by holding the 2 buttons down until the apple appears AND I restarted my computer. After that everything worked.

  • I'm getting an error message saying iPhone 4S cannot be used because it requires iTunes version 11.1 or later. I've checked

    I'm getting an error message saying iPhone 4S cannot be used because it requires iTunes version 11.1 or later. I've checked

    Download itunes 11.1 from
    www.apple.com/itunes/download/
    from Safari.  Not Google Chrome! It only offers 11.0.5 in google chrome.  I had the same problem and fixed it by downloading the newest itunes (11.1) from Safari.

  • I have SSRS parametarized report in that one data set have repeated values with query parameter . but while am mapping that query parameter to report parameter i need to pass distinct values. How can i resolve this

    I have SSRS parametarized report in that one data set have repeated values with query parameter . but while am mapping that query
    parameter to report parameter i need to pass distinct values. How can i resolve this

    Hi nancharaiah,
    If I understand correctly, you want to pass distinct values to report parameter. In Reporting Service, there are only three methods for parameter's Available Values:
    None
    Specify values
    Get values from a query
    If we utilize the third option that get values from a dataset query, then the all available values are from the returns of the dataset. So if we want to pass distinct values from a dataset, we need to make the dataset returns distinct values. The following
    sample is for your reference:
    Select distinct field_name  from table_name
    If you have any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Trying to update iTunes on iPhone 4s. Went to site, selected download, says thank you. Plug phone into computer and pops up cannot be used phone requires 10.5 blah blah blah. What m I doing wrong?

    Trying to update iTunes on iPhone 4s. Went to site, selected download, says thank you. Plug phone into computer and pops up cannot be used phone requires 10.5 blah blah blah. What m I doing wrong?

    i used to have no trouble downloading music on my iphone 4s from i tunes, but now it just says cant download try later. is this caused by not having the current update or something else?

  • How to retrieve Task Lists from All Subsites to the Parent Site and display in Grid view using CAML Query

    How to retrieve Task Lists from All Subsites to the Parent Site and display in  Grid view using CAML Query + object model

    do u just want task list or items under task list for all subsites
    for items use spsitedataquery ref
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsitedataquery.aspx use recursive to get it from alll subsite under site collection
    for tasklist only u can a simply use a for loop to find in all subsite
    Manish Sati

  • HT2801 USB SuperDrive disc icon does not appear and therefore SuperDrive cannot be used

    USB SuperDrive disc icon does not appear and therefore SuperDrive cannot be used.
    There is NO advice regarding this issue on Apple Support.
    Any recommendations?

    Also if you don't have this option checked in the Finder Preferences you won't get an icon on the desktop when a disc is inserted.

Maybe you are looking for