Query

  • Hi

    I  have data like below. Brands can be dynamic

    Loc1            Brand          Qty        Value

    Loc1            Omega         10          1000000

    Loc2            Swatch          5            25000

    Loc1           Swatch           8            32000

    Output

    Location        Omega Qty      Omega Value     Swatch qty           Swatch Value

    Loc1                   10                   1000000                 5                           25000

    Loc2                                                                              8                         32000

  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

  • Use a matrix in SSRS?

  • jsshivalik wrote:

    Hi

    I  have data like below. Brands can be dynamic

    Loc1            Brand          Qty        Value

    Loc1            Omega         10          1000000

    Loc2            Swatch          5            25000

    Loc1           Swatch           8            32000

    If you'd post the data in a readily consumable (the article at the first link in my signature for one way to do that), I'd already have it done for ya.

    In the meantime, the following article shows how to do such a dynamic "CROSSTAB".

    https://www.sqlservercentral.com/articles/cross-tabs-and-pivots-part-2-dynamic-cross-tabs

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

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

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