Chat spot

Since your Tableau data has Products, Revenue, and Cost in the same column, with the same years, we need to aggregate each data type correctly and format Products as a number and Revenue/Cost as dollars.
 I'll assume your data is structured like this: 

Year Data Type Value
2023 Products   150
2023 Revenue   25000
2023 Cost           10000
2024 Products    200
2024 Revenue    30000
2024 Cost            12000 

 Step 1: Create three calculated fields In Tableau Desktop, right-click the Data pane → Create Calculated Field. 

 1. Total Products 
SUM( IF [Data Type] = "Products" THEN [Value] END ) 
------------------------
 2. Total Revenue 
SUM( IF [Data Type] = "Revenue" THEN [Value] END )
 ----------—--------------- 
3. Total Cost 
SUM( IF [Data Type] = "Cost" THEN [Value] END ) 

Right-click each calculated field. Select Default Properties → Number Format. Choose Currency (Standard) or Currency (Custom). 

Select $ and the desired decimal places. Examples: $25,000 and $10,000 

Step 3: Display the results by year For a simple table: Drag Year to Rows. Drag Measure Names to Columns. Drag Measure Values to Text on the Marks card. 

Filter Measure Names to show only Total Products, Total Revenue, and Total Cost. 

Your output will look like this: 

Year Total Products Total Revenue Total Cost
2023       150               $25,000.             $10,000
2024       200               $30,000.             $12,000

 You can also use three KPI cards or separate charts. Important: What if you need one combined column? If you want a single displayed measure that automatically shows Products as 150 and Revenue/Cost as $25,000, Tableau's standard number formatting cannot apply different numeric formats to different categories within one measure. You can create a display-only calculated field:
 
IF [Data Type] = "Products" THEN STR(INT(SUM([Value]))) ELSE "$" + STR(ROUND(SUM([Value]), 2)) END

 However, this expression may trigger an aggregate/non-aggregate error because [Data Type] is row-level while SUM([Value]) is aggregated. For a reliable solution, use separate measures as above, or create a carefully designed aggregated string calculation based on the dimensions in your view.

Comments

Popular posts from this blog

How to Port from Aircel easily.

Text summarization sample