SSRS Expressions Tips and Tricks

  • Frank Fernando

    SSC Enthusiast

    Points: 155

    Comments posted to this topic are about the item SSRS Expressions Tips and Tricks

  • Fatherjack

    SSCommitted

    Points: 1573

    Frank, there are some cases where your formulas dont give the correct values. When you use a series of dates from 2008 formulas 3 + 4 return the wrong days.

  • Misha_SQL

    SSCertifiable

    Points: 5386

    Love this collection of tips! I think this article deserves a continuation.

    Thank you.

  • crunchycocktail

    SSC Enthusiast

    Points: 108

    Hi guys. i have tried one of your expressions:

    iff( rownumber(nothing) mod2, "blue","green")

    i have a two groups and in the details again have grouped by three fields so that i can get sum for same kind of items. so i have applied this formatting to the details row but when i see the report it is showing two rows same color and again one row different and again two rows same. i dont get to know what is happening...

  • bendy1999

    SSC Eights!

    Points: 932

    Thanks for the Tips, some of them have already come in quite handy.

    For the Expression 4, I must warn you that they will not always return the last day of the month. Let me explain this in an example:

    Lets assume today is the 22nd of March. Now lets run that through your Expression.

    First, we deduct the day-number from the current date

    DateAdd("d", -1.0 * DatePart("d", Today)

    that leaves us with 2010-02-28, the last date of the LAST month. so far so good.

    Now you add one month to get the final result

    =DateAdd("m", 1, "QueryAbove", Today))

    This will result in the following date: 2010-03-28 which is not the last date of this month.

    I've been using a very similar expression for quite some time and noticed my mistake only after some customers started to complain. Fortunately only default-dates were affected, so the customers could manually override them. It was a painful workaround, but at least they had one.

    I suggest to reverse your Expression to the following

    =DateAdd("d", -1.0 * DatePart("d", DateAdd("M", 1, Today)), DatePart("d", DateAdd("M", 1, Today)))

    Like this, you will first jump to the next month and then subtract all excess days.

    I've written these Expressions out of my head and haven't tested them. So you might find the odd typo or something.

    Best Regards

    Bendy

  • jammy

    SSC Journeyman

    Points: 80

    Excellent post! very helpful. I am waiting for rest of tricks in the bag 🙂

    Just another expressions which I am working on currently. Please let me know if you have any ideas.

    I have report with "Jump to Report" set. It is working fine. I would like to disable the hyperlink if value is 0. Is it possible to do using expressions?

    thanks a lot! and keep up good work

  • Michael-321617

    SSC Rookie

    Points: 33

    Thank you very much Frank...I am a newbie to SSRS and this will very helpful 😀

  • emmettjarlath

    SSC Veteran

    Points: 202

    Hi Frank,

    Your last point: "As a quick note, did you know that you can upload Excel, Access, HTML and other files to reporting services. Very handy especially if you want to include a help file with your report etc"

    Can you expand on this point?

    Regards,

    Emmett

Viewing 8 posts - 1 through 8 (of 8 total)

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