2 Replies Latest reply on Mar 20, 2017 2:13 PM by Tableauuser h

    Month to date and full month calculated metric

    Tableauuser h

      Hello,

       

      Can someone please help me (ideally as soon as anyone can!).

       

      I have spent a while trying to do this and have not gotten anywhere. I am trying to create a calculated metric for month to date (month to yesterdays date) and total month calculation.

       

      Then this should be used as a filter.

       

      I dont have a workbook I can show, but would appreciate code examples of what I could use.

       

      Thank you!

        • 1. Re: Month to date and full month calculated metric
          Norbert Maijoor

          Hi,

           

          FInd my approach as reference below in attached workbook version 9.3 located in the original thread.

           

           

           

          1. MTD: if datediff('month',[date],[date Parameter])=0 and [date]<[date Parameter]-1 then [value] END

          2. Current Month: if datediff('month',[date],[date Parameter])=0  then [value] END

           

           

          Regards,

          Norbert

           

          PS please change your name to your "real name" We try to keep this forum as open an transparant as possible. Thank in advance for your cooperation.

          1 of 1 people found this helpful
          • 2. Re: Month to date and full month calculated metric
            Tableauuser h

            Great thank you very much Norbert!

             

            I had another quick question if that is okay. I am also trying to display the week commencing dates for the month we are on currently. However I need the week commencing dates to start from the 1st of the month. For example if I am reporting for the month March, I dont want the week commencing date 27th Feb (as I just want March). Does that make sense?