3 Replies Latest reply: May 16, 2012 4:39 PM by Jose Tos RSS

    Best way to range date

      HI,

       

      Can someone please advise on the best way to range a certain date?

      Lets say I have a column with date from 01/01/205 to 01/01/2012.

      Another column with Sales Amount.

       

      I would like to range the sales from Fev/2009 to present month Mai/2012.

       

      Also to include month on the range.

       

      Thnaks a lot.

       

      Jorge

        • Best way to range date
          Jose Tos

          Hi,

           

          See that you could create two new variables with the date´s values you want and replace those to StartDate and EndDate so I write both options:

           

          sum({<Date={'>=$(=StartDate)'},Date={'<=$(=EndDate)'}>}[Sales Amount])

           

          sum({<Date={'>=$(=$(vStartDate))'},Date={'<=$(=$(vEndDate))'}>}[Sales Amount])

           

          Try this and tell me.

           

          Regards,

          Chema

            • Best way to range date

              Thanks man,

               

              The first option worked fine.

               

              Now, when a select a diferent month, the date isn´t displayed. The sales amount is fixed to my variables values, do you know how can I leave more flexible? Is it what the second option does?

               

              Thks

              Jorge

                • Best way to range date
                  Jose Tos

                  Hi Jorge

                   

                  With the second option you could choose any dates you want. You need to create 2 entry box where you can write the MinDate and the MaxDate associated with the new variables, so you could use this:

                   

                  sum({<Date={'>=$(=$(vMinDate))'},Date={'<=$(=$(vMaxDate))'}>}[Sales Amount])

                   

                  You could do the same thing with months if you prefer but making a month selection:

                   

                  sum({<Month={'>=$(=$(vMinMonth))'},Date={'<=$(=$(vMaxMonth))'}>}[Sales Amount])

                   

                  Si prefieres, para siguientes ocasiones usamos el español.

                   

                  Saludos, espero que te ayude.