reportbuilder - Report Builder Expressions -


im new report builder , having issues expressions im trying implement in report. got standard ones work try distinctions, error messages. on last couple weeks, ive tried many combinations, read expression help, google , looking @ other questions @ internet sites. reduce frustrations, jump other expressions , walk away hoping have different insight coming back. simple or dont know writing expressions. im hoping can these expressions; versions least errors with(usually expression expected) , show im trying accomplish.

=iif((fields!recordflag.value)='d',countdistinct(fields!ticketnum.value),0) =iif((fields!transtype.value)='1' , (fields!recordflag.value)='a' or    'b',sum(fields!dollars.value),0) =iif((fields!transtype.value)='1' ,    (fields!recordflag.value)='p',sum(fields!dollars.value),0) =sum([dollars] case when [recordflag]='p' -1*[dollars]) 

thank you.

=iif((fields!recordflag.value)=”d”,countdistinct(fields!tick‌​etnum.value))

the error message gives answer here - no false part of iif() has been specified. use =iif((fields!recordflag.value)=”d”,countdistinct(fields!tick‌​etnum.value), 0)

=iif((fields!transtype.value)="1" , (fields!recordflag.value)="a" or "b",sum(fields!dollars.value),0)

this not how or works in ssrs. use: =iif((fields!transtype.value)="1" , (fields!recordflag.value="a" or fields!recordflag.value = "b"),sum(fields!dollars.value),0)

the 0s returned due report design. countdistinct() aggregate function - it's meant used on set of data. however, iif() testing on per row basis - you're saying "if current row thing, count distinct values" doesn't make sense. there couple of ways forward:

  • you can count number of times value occurs in given condition using sum(). not same countdistinct(), if use =sum(iif(fields!recordflag.value = "d", 1, 0)) number of times recordflag d in set. note: requires data aggregated (so in ssrs, grouped in tablix).

  • you can use custom code count distinct values in set. see https://itsalocke.com/aggregate-on-a-lookup-in-ssrs/. can apply if have 1 dataset - reference same 1 twice.

  • you can change way report works. can group on fields!recordflag.value , filter group fields!recordflag.value = "d". in textbox, use =countdistinct(fields!ticketnum.value) distinct values ticketnum when recordflag d.


Comments

Popular posts from this blog

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -