기술 자료

How to calculate the measure of a field that contains a specific string and other fields


게시 날짜: 21 Feb 2023
마지막 수정 날짜: 22 Feb 2023

질문

How to calculate the measure of a field that contains a specific string and other fields.

For example, if you enter "Book", sales in the subcategory containing the string "Book" will be displayed, as well as sales in all other subcategories.
 

환경

  • Tableau Desktop

답변

1. Connect to Sample Superstore data source.
2. Create a new parameter like the following.
User-added image
3. Right click on [Enter Sub Category Name] -> Show Parameter
4. Create a new calculated field as following.
     Name : Sales of Specific Sub Category and the others
     Calculation : IF CONTAINS([Sub-Category],[Enter Sub Category Name]) = TRUE
                          THEN [Sub-Category]
                          ELSE "Others"
                          END
5. Drag [Sales of Specific Sub Category and the others] to Rows.
6. Drag [Sales] to Text on Marks.
User-added image
이 문서로 문제가 해결되었습니까?