사용
named_value_format: desired_name {
value_format: "excel formatting string"
strict_value_format: yes | no
}
|
계층 구조
named_value_format |
기본값
없음
수락
맞춤 형식의 이름과 형식을 정의하는 Excel 스타일 형식 문자열, 선택사항인 strict_value_format 하위 매개변수의 불리언 값
|
정의
named_value_format 매개변수를 사용하면 여러 측정기준과 측정값에 적용할 수 있는 맞춤 형식을 만들고 저장할 수 있습니다.
Looker의 맞춤 형식은 다음과 같은 여러 단계를 거쳐 생성되고 사용됩니다.
- 먼저 모델 파일에서
named_value_format를 사용하여 새 맞춤 형식의 이름을 선언합니다. 이 이름은 공백이 없는 문자열이어야 합니다. - 다음으로
named_value_format아래의value_format하위 매개변수를 사용하여 Excel 스타일 형식 문자열을 제공하여 원하는 형식을 정의합니다. - 마지막으로 필드 수준에서
value_format_name매개변수를 참조하여 측정기준과 측정값에 이 맞춤 형식을 적용합니다.
다음 예와 같이 모델에서 맞춤 형식을 두 개 이상 정의할 수 있습니다.
일반적인 value_format 형식 지정 문자열
value_format매개변수에 사용된 형식은 시각화의 값 형식 필드에 사용된 형식과 동일하지만,value_format매개변수를 사용하기 위해서는 형식 지정 문자열을 큰따옴표로 묶어야 합니다. 시각화의 값 형식에 대한 자세한 내용은 열 차트 옵션 문서 페이지를 참고하세요.
이러한 형식을 지정하는 방법은 Excel의 전체 가이드 문서에서 확인할 수 있습니다. 하지만 현재 Looker에서는 날짜 형식 지정, 색상 형식 지정, 16진수 변환이 지원되지 않습니다.
다음은 가장 일반적인 형식 지정 옵션 중 일부입니다. 국제 통화 기호와 같은 일부 특수문자는 큰따옴표로 묶어야 합니다.
value_format: "0" # Integer (123)
value_format: "*00#" # Integer zero-padded to 3 places (001)
value_format: "0 \" String\"" # Integer followed by a string (123 String)
# Please note "String" can be replaced with any other word
value_format: "0.##" # Number up to 2 decimals (1. or 1.2 or 1.23)
value_format: "0.00" # Number with exactly 2 decimals (1.23)
value_format: "*00#.00" # Number zero-padded to 3 places and exactly 2 decimals (001.23)
value_format: "#,##0" # Number with comma between thousands (1,234)
value_format: "#,##0.00" # Number with comma between thousands and 2 decimals (1,234.00)
value_format: "0.000,,\" M\"" # Number in millions with 3 decimals (1.234 M)
# Please note division by 1 million happens automatically
value_format: "0.000,\" K\"" # Number in thousands with 3 decimals (1.234 K)
# Please note division by 1 thousand happens automatically
value_format: "$0" # Dollars with 0 decimals ($123)
value_format: "$0.00" # Dollars with 2 decimals ($123.00)
value_format: "\"€\"0" # Euros with 0 decimals (€123)
value_format: "$#,##0.00" # Dollars with comma btwn thousands and 2 decimals ($1,234.00)
value_format: "$#.00;($#.00)" # Dollars with 2 decimals, positive values displayed
# normally, negative values wrapped in parenthesis
value_format: "0\%" # Display as percent with 0 decimals (1 becomes 1%)
value_format: "0.00\%" # Display as percent with 2 decimals (1 becomes 1.00%)
value_format: "0%" # Convert to percent with 0 decimals (.01 becomes 1%)
value_format: "0.00%" # Convert to percent with 2 decimals (.01 becomes 1.00%)
strict_value_format가 number_format 사용자 속성을 재정의합니다.
일반적으로 number_format 사용자 속성에 설정된 숫자 형식은 named_value_format으로 생성된 형식 위에 적용됩니다. 하지만 선택사항인 strict_number_format 하위 매개변수를 yes로 설정하면 number_format의 형식이 적용되지 않으며 필드에 named_value_format의 형식이 유지됩니다. 예시를 확인하고 자세히 알아보려면 숫자 형식 현지화 문서 페이지를 참고하세요.
기본 서식 옵션
Looker의 기본 제공 값 형식 중 하나를 적용하려면 value_format_name 매개변수의 문서 페이지에 있는 기본 형식 이름 섹션에 나열된 형식 중에서 선택하면 됩니다. value_format_name를 사용하여 기본 형식을 적용하는 방법은 해당 페이지를 참고하세요.
예시
€1.23K와 같은 euro_in_thousands라는 맞춤 형식을 만듭니다.
named_value_format: euro_in_thousands {
value_format: "\"€\"0.000,\" K\""
}
number_formatting 사용자 속성이 euro_in_thousands 형식에 영향을 미치지 않도록 합니다.
named_value_format: euro_in_thousands {
value_format: "\"€\"0.000,\" K\""
strict_value_format: yes
}
숫자 형식 지정 문서 페이지에서 다른 예시를 확인할 수도 있습니다.
$1.23M과 같은 usd_in_millions라는 맞춤 형식과 (123) 456-7890과 같은 phone_number라는 형식을 만듭니다.
named_value_format: usd_in_millions {
value_format: "$0.000,,\" M\""
}
named_value_format: phone_number {
value_format: "(###) ###-####"
}