Generate Random Number in SSRS

  • Can anyone out there advise me on how to generate a random number within in SSRS by means of a function and/or expression? I understand this can be done using TSQL, I would like to know how to accomplish this within SSRS.

    My attempt so far is: =RunningValue(Fields!qty.Value, COUNT, Nothing)

    Which is not random enough...

    Thanks in Advance for any help!!

  • Rnd is a random function

  • Thanks Jo for the reply. The rnd function certainly does what I need. My only problem now is that I want to only display the numbers after the decimal.

  • Can you give an example of "only display the numbers after the decimal related to random"?

  • GBeezy (6/18/2014)


    Thanks Jo for the reply. The rnd function certainly does what I need. My only problem now is that I want to only display the numbers after the decimal.

    You could treat it as a string, search for the decimal seperator and take everything that comes after it.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Koen Verbeeck (6/19/2014)


    GBeezy (6/18/2014)


    Thanks Jo for the reply. The rnd function certainly does what I need. My only problem now is that I want to only display the numbers after the decimal.

    You could treat it as a string, search for the decimal seperator and take everything that comes after it.

    Or if you want a fixed number of decimals, let's say 3, you can for example multiply by 1000 and then take the modulo of 1000.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • CEILING(RND()*1000)

    Might help someone.

Viewing 7 posts - 1 through 6 (of 6 total)

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