sumif in textbox

  • I am trying to make a textbox that has a single value from the table that i'm using. Assume this is the query of Dataset1:

    select 'Apples' as Fruit,3 as StockNL, 5 as StockEN

    union select 'Pears',5,7

    union select ' Bananas',9,8

    Now I't easy to create a table within my report, but what I am trying to do s to just show the amount of apples in England (5) in a textbox.

    The expression would be something like this:

    =sum(iif(Fields!Fruit.Value="Apples",Fields!StockEN.Value,0))

    However, I have no idea how to impement this into a textbox. Also, If I input this formula as a extra column in the table, it works on a individual level, but not on a total level:

    Apples 3 5 5

    Pears 5 7 0

    Bananas 9 9 0

    Total 17 21 #error

    Can anyone help me with these issues?

  • Hi

    It's a known issue because the data type inside the IIF cannot be qualified

    You have to cast the data or use nothing instead of 0

    =sum(iif(Fields!Fruit.Value="Apples",Fields!StockEN.Value,nothing))

    :w00t: !!!GOOGLE IS YOUR BEST FRIEND!!! :w00t:

  • That helped put the required value in the Totals row, thank you. However, the main question is: How do i put this value in a textbox? I need multiple textboxes with such values, and my actual list is way longer (in both rows and columns), so just setting the value of a textbox to value of the lower right cell would be very tedious , so that is not the solution.

    Any ideas?

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

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