Recuperantion des données pour certains dimensions

  • Bonjour,

    Je suis nouveau sur SSRS, et je souhaiterais savoir si vous avez une idée car je suis bloqué...

    Bon, j'ai un dataset composé des données de mon rapport (Date, Montant vente, Ville, Partenaire, Article), et j'ai mis un paramètre "date" dans mon rapport.

    Ce que je souhaite avoir maintenant est un montant de vente pour chaque article à une date où l'année est l'année N-1 de l'année de la date seléctionner sur le paramètre.

    Exemple : si je selectione la date 23/10/2016 j'obtiens le montant de la vente pour la date 23/10/2015

    Ma source de données est une CUBE (SSAS), donc le requette est en MDX.

    Merci d'avance pour vos suggestions.

    Tsiry

  • (Sorry, response in English) If I understand the Google translate correctly, you'll need to add something to your query to also include the sales from a year ago. Here's a pseudo-code example:

    SELECT

    sale_date

    ,SUM([Amount sale]) as Sales

    FROM sales

    WHERE sale_date = @date

    OR sale_date = DATEADD(YEAR, -1, @date)

    GROUP BY sale_date

  • doug.brown (11/3/2016)


    (Sorry, response in English) If I understand the Google translate correctly, you'll need to add something to your query to also include the sales from a year ago. Here's a pseudo-code example:

    SELECT

    sale_date

    ,SUM([Amount sale]) as Sales

    FROM sales

    WHERE sale_date = @date

    OR sale_date = DATEADD(YEAR, -1, @date)

    GROUP BY sale_date

    I believe that you understood correctly, except for the part that the OP needs to get the MDX query instead of T-SQL.

    I know it's possible but my skills on MDX are just enough to understand it, but not create new code.

    La plupart des utilisateurs de ce forum parlent anglais et seulment quelques-uns parlent français. Vous obtiendrez une meilleure aide si vous publiez en anglais.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Luis Cazares (11/3/2016)


    I believe that you understood correctly, except for the part that the OP needs to get the MDX query instead of T-SQL.

    I know it's possible but my skills on MDX are just enough to understand it, but not create new code.

    Perhaps the op can translate SQL to MDX. 😉

    --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)

  • Jeff Moden (11/3/2016)


    Luis Cazares (11/3/2016)


    I believe that you understood correctly, except for the part that the OP needs to get the MDX query instead of T-SQL.

    I know it's possible but my skills on MDX are just enough to understand it, but not create new code.

    Perhaps the op can translate SQL to MDX. 😉

    I'm not sure if it's that easy. It also depends on how the time dimension is built. There's an option for previous member which can be used if the dimension has year as part of the hierarchy.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Luis Cazares (11/4/2016)


    Jeff Moden (11/3/2016)


    Luis Cazares (11/3/2016)


    I believe that you understood correctly, except for the part that the OP needs to get the MDX query instead of T-SQL.

    I know it's possible but my skills on MDX are just enough to understand it, but not create new code.

    Perhaps the op can translate SQL to MDX. 😉

    I'm not sure if it's that easy. It also depends on how the time dimension is built. There's an option for previous member which can be used if the dimension has year as part of the hierarchy.

    I was expressing a bit of irony. 😉

    --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 6 posts - 1 through 5 (of 5 total)

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