Country or region and language

    Choose your country or region and your language.

    Suggested for you

      All countries and regions

        Choose your character

        It shows in the top bar and on your profile. Change it any time.

        Sign in or join

        A sample dataset for Tableau

        Copy a sample dataset for Tableau, connect the CSV file, and check sales totals and unique orders before filtering categories in a simple, repeatable exercise.

        A person practicing on a laptop in a quiet workspace

        Use the fictional office-supplier CSV below as a sample dataset for Tableau: save its header and six data rows as office_orders.csv, then connect through Text file in Tableau Desktop. You'll build a sales-by-city chart, check unique orders, and see why category-level order counts don't always add up to the overall count.

        A ready-to-copy practice dataset

        The dataset represents order lines, not complete orders. That distinction is its grain: the meaning of one row. An order can include more than one category, so repeated order identifiers are intentional.

        A CSV is a plain-text file with values separated by commas. Create the file in a plain-text editor, rather than a word processor, and keep the column names unchanged so the calculation works as written. These instructions use Tableau Desktop, not browser authoring.

        The CSV and expected answers

        The complete exercise below includes the CSV, worksheet steps, calculations, and expected results. Copy only the header and six data rows into the file, not the surrounding instructions. Keep the rest of the specification available as your answer key.

        Fictional exercise: order lines for a small office supplier
        Tool: Tableau Desktop
        Goal: show sales by city and count unique orders without counting order lines as orders.
        Currency: Indian rupees; Sales INR contains numeric amounts without currency symbols.
        Starting state: a new Tableau workbook with no connected data.
        
        Create a plain-text file named office_orders.csv.
        Copy only the following header and six data rows into the file:
        
        Order ID,City,Category,Sales INR
        O101,Pune,Furniture,2000
        O101,Pune,Supplies,500
        O102,Kochi,Supplies,800
        O103,Pune,Furniture,3000
        O104,Kochi,Furniture,1500
        O104,Kochi,Supplies,200
        
        Data contract:
        One row = one order line.
        Order ID = text identifier; repeated identifiers are valid.
        City and Category = text.
        Sales INR = whole-number sales amount for that line.
        
        Baseline steps:
        1. Connect through Text file and select office_orders.csv.
        2. Check that Sales INR has a numeric data type.
        3. Open a worksheet. Drag City to Rows and Sales INR to Columns.
        4. Keep the Sales INR aggregation as SUM and select Bar on the Marks card.
        
        Expected sales chart values:
        City    Sales INR
        Kochi   2500
        Pune    5500
        Total   8000
        
        5. Select Analysis > Create Calculated Field.
        6. Name the field Unique orders and enter:
        COUNTD([Order ID])
        7. Open another worksheet. Drag City to Rows and Unique orders to Text
           on the Marks card.
        
        Expected unique orders by city:
        City    Unique orders
        Kochi   2
        Pune    2
        
        8. Remove City from Rows on the unique-orders worksheet.
        Expected overall unique orders: 4.
        9. Restore City to Rows.
        
        Baseline checks:
        Source rows = 6
        Unique orders across all rows = 4
        Sales across all rows = 8000
        Pune sales = 2000 + 500 + 3000 = 5500
        Kochi sales = 800 + 1500 + 200 = 2500
        
        Variation:
        On the sales worksheet, drag Category to Filters.
        Keep Furniture only; don't edit the CSV.
        Expected sales: Kochi = 1500; Pune = 5000; total = 6500.
        
        On the unique-orders worksheet, drag Category to Filters.
        Keep Furniture only.
        Expected unique orders: Kochi = 1; Pune = 2.
        Remove City from Rows to check the overall count: 3.
        Restore City to Rows.
        
        Non-additive count check:
        On the unique-orders worksheet, remove the Category filter.
        Replace City on Rows with Category.
        Expected counts: Furniture = 3; Supplies = 3.
        Remove Category from Rows to check the overall count: 4.
        Reason: O101 and O104 occur in both categories.
        Category counts sum to 6, but only 4 different orders exist.

        Don't delete the repeated identifiers. Each repeated identifier belongs to another valid order line with its own sales amount. Removing those records would reduce sales and change the question you're answering.

        Practice what this post teaches

        The first Tableau worksheet

        The first worksheet groups the order lines by city and adds their sales amounts. Grouping and combining records into displayed values is called aggregation.

        In Tableau Desktop, select Text file under the connection options and open office_orders.csv. On the data source page, inspect the preview: the file should have four columns and six data rows. If everything appears in one column, check that the saved file uses commas between values.

        Check the data-type icon for Sales INR. The field should be numeric, not text; if necessary, use the field's data-type menu to choose Number (whole). Keep Order ID as text because an identifier labels a record rather than measuring an amount.

        • Open a worksheet and drag City to the Rows shelf. City is a dimension, a field used to group records.
        • Drag Sales INR to the Columns shelf. Sales INR is a measure, a field whose numeric values can be aggregated.
        • Check that the Sales INR pill uses SUM. If necessary, open its menu and choose Measure > Sum.
        • Select Bar on the Marks card, which controls how Tableau draws the displayed marks.

        Compare the bars with the preserved answer key immediately: Kochi should show 2,500 and Pune should show 5,500. Together, the bars account for all 8,000 rupees in the source. Don't add colors or labels until both amounts match.

        For independent hands-on practice, try the Tableau course at The Work Gym. Its practice uses automatic checking with hints that name mistakes.

        Unique orders and a category filter

        Unique orders count different order identifiers, not order lines. COUNTD is Tableau's distinct-count function: repeated occurrences of the same value contribute only once within the group being calculated.

        Create the Unique orders calculated field using the expression in the specification. A calculated field is a field defined by an expression rather than supplied directly by the CSV. On a new worksheet, put City on Rows and Unique orders on Text on the Marks card.

        Check the displayed counts now: each city should have two unique orders. Remove City from Rows to verify the overall count of four, then restore City. Don't count the bars on the sales chart to infer orders: those bars represent cities.

        The Furniture-only variation

        A category filter restricts the records used by a worksheet. On the sales worksheet, drag Category to Filters and keep only Furniture. The bars should now show 1,500 for Kochi and 5,000 for Pune, totaling 6,500.

        Next, switch to the unique-orders worksheet and apply the same Furniture-only filter there. Kochi should show one unique order and Pune two. Remove City from Rows to check the overall count of three, then restore City.

        Apply the filter separately because filtering one worksheet doesn't automatically establish the same filter on another worksheet. Comparing filtered sales with unfiltered orders would mix two different sets of records.

        The category-count check

        Category-level distinct counts overlap because an order can belong to both categories. On the unique-orders worksheet, remove the Category filter, then replace City on Rows with Category. Furniture and Supplies should each show three unique orders.

        Remove Category from Rows next. Tableau should recalculate the overall distinct count as four, not six. Orders O101 and O104 appear in both category groups, but each belongs only once in the overall set of orders.

        That behavior makes the distinct count non-additive: adding group counts doesn't necessarily produce a valid overall count. In this dataset, the city counts happen to add correctly because no order belongs to both cities. The category counts don't have that property.

        For your next practice step, try Level of detail on two datasets.

        Import mistakes and practice limits

        Most errors in this exercise come from field types, aggregation, row meaning, or filter scope. Use the symptom to choose a check instead of guessing from the chart's appearance.

        Troubleshooting checks
        Visible symptomLikely causeExact check
        Sales displays record countsSales INR is text or uses CountSet Sales INR to a numeric type and choose Measure > Sum.
        Order count matches the number of linesThe calculation counts occurrences rather than distinct identifiersInspect Unique orders and confirm it uses COUNTD on Order ID.
        Worksheets disagree after filteringThe worksheets use different Category selectionsOpen Category on each Filters shelf and compare the selected values.
        Category counts exceed the overall order countSome orders belong to multiple categoriesRemove Category from Rows and check the recalculated overall distinct count.

        Treat Sales INR as the sales amount for the whole line, not a unit price. The CSV has no quantity field, so don't multiply sales amounts or infer quantities.

        The small, clean file is useful for checking imports and aggregation, but it doesn't cover date parsing, missing values, relationships between tables, or performance with large files. Save the workbook with both worksheets so you can repeat the baseline checks before trying more complex data.

        Common questions

        How do I create a CSV sample dataset for Tableau? Copy the header and six data rows from the exercise into a plain-text editor and save the file as office_orders.csv. In Tableau Desktop, select Text file and open the saved file.

        What does one row represent in this dataset? One row represents one order line, not a complete order. Repeated order identifiers are valid because the same order can contain lines from different categories.

        Why does Tableau count my sales values instead of summing them? Sales INR may have been imported as text, or its aggregation may be set to Count. Check that the field is numeric, then choose Measure > Sum from the field pill's menu.

        How do I count unique orders in Tableau? Create the Unique orders calculated field using the COUNTD expression in the exercise specification. With no category filter and no grouping dimension, the sample dataset should return four unique orders.

        Why don't the category-level order counts add up to the overall count? O101 and O104 appear in both Furniture and Supplies, so adding the category counts counts those orders twice. Each category has three unique orders, but the overall dataset contains only four different order identifiers.

        Practice what this post teaches

        Your Work Gym account

        Save your progress and pick up on another device. Your browser's progress comes with you.

        Your account can start a 5-day free trial: every course, unit, project and exam. Card needed; cancel any time and pay nothing.

        New accounts get 6 hours of full access: every course, unit, project and exam. The clock starts when you go past the free lessons.

        Plan your practice from a job ad or syllabus

        Have a referral code?

        or

        You can keep practicing without an account.

        Help and feedback

        Ask a question, tell us what is not working, or share an idea. We reply by email.

        What is it about?

        We use it only to reply to you.