QBoard » Advanced Visualizations » Viz - Tableau » Tableau count number of times same value appears in column

Tableau count number of times same value appears in column

  • I have a field such that

    Color
    Pink
    Blue
    Pink
    Blue
    Pink
    Pink
    Pink
    Pink
    Pink
    Blue
    Blue
    Pink
    Pink
    Pink
    Blue
    Pink
    Blue
    Pink
    Blue

    How to create calculated field to count number of times Pink appears?

    Total numbers of Blue?

      September 17, 2021 10:19 PM IST
    0
  • Trying to count the number of times 1 appears in each column. total each column.  examples using WaitingProposal  (columns shown in sheet 2)

    calculating the number of times waitingProposal shows up in the column data with regards to the filters

    waitingProposal = 50 should be?

    These are the things I have tried: shown in sheet 3

    NumberIds = {FIXED [C Id (Workitem)]:COUNTD([C Id (Workitem)])}

    Count Weeks = Window_Count(Count([WaitingProposal]))

    NumberIdswp = {FIXED [C Status (Workitem)] : COUNTD([C Status (Workitem)] == 'waitingProposal')}

    Sumwp = SUM( INT ( [C Status (Workitem)] = "waitingProposal" ) )

    Total = TOTAL(COUNTD([WaitingProposal]))

     

    WaitingProposal = IF ( [C Status (Workitem)] == 'waitingProposal' AND [Max Update] = true ) THEN 1 ELSE 0 END /* used this to mark 1 or 0 for counting

     

    countwp = sum ( [WaitingProposal] )

    sumwptotal = Total(SUM ( INT ( [C Status (Workitem)] = "waitingProposal" ) ))

     

    pastedImage_2.png

      October 13, 2021 2:02 PM IST
    0
    • Tableau's Sample Superstore dataset can be used to walk through one way you can show the top N number of Products by Category. This example will easily transfer to Dog Names by Neighborhood.

    • Create a Tableau calculation and use as a filter later.

    RANK(COUNT([Product Name]))

    image

    • And then put the Category and Product Names dimension on the Rows shelf and the Count of Product Names on the Text marks card.

    • Now, place the Production Popularity table calculation on the filter shelf.

    • When the dialog box appears, just click OK.

    • Edit accordingly how our Table calculation runs to get the Top N Product Names within each Category.

    enter image description here

    • Now, Select Specific dimension and then uncheck Category or Neighborhood in your case.

    enter image description here

    • Now we need to go edit our filter.

    enter image description here

    • For this example,Set the upper limit to 3.

    enter image description here

    • Click OK and then you must be able to see the top 3 Product Names by Category.

    enter image description here

      October 18, 2021 1:55 PM IST
    0
  • If you're grouping by Color and only Color in the view, then you can simply use SUM(Number of Records). For example, put Color in the Rows shelf and SUM(Number of Records) into Text, and you'll get a table with the counts for each Color.

    If you need to specify the level of detail, Tableau has LOD (level-of-detail) expressions that will make this easy.

    { FIXED  : SUM([Number of Records]) }
    ​

    That statement says to calculate the SUM() of [Number of Records] and to group by , regardless of the level of detail in the view.

    FYI, [Number of Records] is a calculated field that Tableau automatically tosses into every data source. Here's the code:

    1​


    This simply places a 1 in every row of your partition. If you SUM() those ones, you'll get the number of records. So your LOD calculation could have just as easily been:


    { FIXED  : SUM(1) }
    ​
      September 18, 2021 12:37 PM IST
    0