Forum Discussion

bhartsell's avatar
bhartsell
Frequent Visitor
9 years ago
Solved

Include Zero on a Table

I'm making a table visual with two columns, Name and Count. This works perfectly well at counting data, but I also want to include "Names" for which there is no data (thus the Count would be 0). How can I do this?

  • Oh right, so you're using the 'Count' aggregation from the dropdown on the field.

     

    I think you'll need to define your own measure instead to stop the blank row removal.

    e.g.

    Count Measure = COUNT( Table[Column] ) + 0

8 Replies

  • bhartsell,

     

    The simplest way I know of is to add +0 to the end of your measure.

    This will convert blanks to zero and leave nonblanks unchanged.

    • bhartsell's avatar
      bhartsell
      Frequent Visitor

      I'm not using a measure, though. It's a table where "Name" is a text value and "Count" is a count of the data. 

      • OwenAuger's avatar
        OwenAuger
        Super User

        Oh right, so you're using the 'Count' aggregation from the dropdown on the field.

         

        I think you'll need to define your own measure instead to stop the blank row removal.

        e.g.

        Count Measure = COUNT( Table[Column] ) + 0

  • CahabaData's avatar
    CahabaData
    Memorable Member

    I will assume that the data table in which you are working - if a name has no data/record then it does not appear in this table.  Let's call this Table1

     

    So you need a data table that has all names - possible you need to create that, which is a straight forward task using the New Table feature.  In any case call that Name Table.

     

    Have a join line between these 2 data tables

     

    Then in your Visual table use Name table, and a Measure =Count(Related(Table1)) 

     

    Just air code but that's the idea I think will work.

  • sraj's avatar
    sraj
    Responsive Resident

    What if we have this as a column and not a calculated measure as mentioned above?