3 Replies Latest reply on Apr 11, 2018 6:02 AM by Jim Dehner

    How to get distinct count of company codes based on monthwise

    srikanth t

      Hi All,

       

      How to get distinct count of company codes based on month wise. can any one help me in these.

       

      I am getting distinct company code count (5190) as per over all figure. Which is correct

      but my requirement is month level discount company code based on 5190 over all distinct company code count ,

      which I am getting incorrect counts like it is considering each month level distinct company codes counts.

       

       

       

      Regards,

      Sri

        • 1. Re: How to get distinct count of company codes based on monthwise
          Tushar  More

          Hi Sri,

           

          Please post .twbx file or sample data.

          • 2. Re: How to get distinct count of company codes based on monthwise
            Nerea Cid Vieytes

            Hi Sri,

             

            Have you tried an LOD ? If you have a variable with the month , a calculated parameter like { INCLUDE [Month] : COUNTD([CompanyCode]) } may help.

            This forces Tableau to calculate it always at a month level so the total should count that. Also make sure that Company Code is a dimension instead of a measure, in your screenshot it seems it was a measure.

             

            More info on LODs: Overview: Level of Detail Expressions

            • 3. Re: How to get distinct count of company codes based on monthwise
              Jim Dehner

              Good morning

              I'm a little confused - please help me better understand the goal - the view you show is giving you the distinct count of company codes each month - and is so doing an account can be counted in January and again in February - the total that you are getting is the distinct count overall (note - tableau does not just add the individual values in the row to get the total - it calculates the total based on the filters and the aggregation factor  overall -

              No if you wanted to count each company code only once and (a guess on my part) the first month they appear - that is a different question

               

              first you would determine the first order date for each customer as

               

              then count the customer when the order date = that first date

               

               

              using superstore data for 2014 (first year in the data ) and 2015 the data would return

               

               

              when summed by year it would look like this

               

               

              Jim

               

              If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.