2 Replies Latest reply on Mar 13, 2017 7:21 AM by KAREN LUNA

    how to SUM only two colums???


      I have a problem... i have a page where i can see my clients and then i watn to see how much they have bought for month in the last 6 months... but! my problem is that i want to be able to make a SUM but only for the las 2 colums.. so i can see wich costumers havent been buying anything in the last 2 months. is this possible?



      Karen L

        • 1. Re: how to SUM only two colums???
          Tom W

          Your 'columns' are members of your date dimension I'm guessing?

          You can create a calculated field like this which will pull the two months prior to December 31 2016;


          SUM(IF DATETRUNC('month',[Order Date])>= DATETRUNC('month',dateadd('month',-1,#2016-12-31#))


              DATETRUNC('month',[Order Date])<= DATETRUNC('month',#2016-12-31#)

              then [Sales]




          Replace #2016-12-31# with the date you want to use (or a parameter) or the NOW() function to anchor it to 'today'.

          • 2. Re: how to SUM only two colums???
            KAREN LUNA

            Hi Tom! Thanks so much for your respons!

            the thing is.. it does not work i dont know what im doing worng.. it marks tow error, my tableau is in Spanish so i will try to translate as best as i can.


            1) DATETRUNC is being called with (integer), did you mean (string, datetime)??

            2) Cannot mix aggregate and non-aggregate comparisons or results if IF expressoins.


            I will appriciate it so so so much if you could help me out, i been looking for a way to do this all over the internet and came out empty