CUSTOMDATA ดึงข้อความ Custom Data ที่แนบมากับการเชื่อมต่อ (เช่นค่า user role, region, หรือ token จากแอป) เพื่อนำไปใช้ใน Measure หรือ RLS ช่วยสร้างเงื่อนไขตามบริบทผู้ใช้โดยไม่ต้องแก้โมเดล
=CUSTOMDATA()
=CUSTOMDATA()
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
| (none) | text | Optional | – | ไม่มีอาร์กิวเมนต์ เรียกใช้เพื่อตรวจสอบข้อความ Custom Data ที่แนบมากับการเชื่อมต่อ |
Session Label = CUSTOMDATA()Session Label = CUSTOMDATA()
ค่าข้อความที่แนบมากับการเชื่อมต่อ เช่น "premium-user"
User Tier = IF( CUSTOMDATA() = "premium", "Premium", "Standard" )User Tier = IF( CUSTOMDATA() = "premium", "Premium", "Standard" )
"Premium" หรือ "Standard"
Sales (Custom Region) = CALCULATE( [Total Sales], Customers[Region] = CUSTOMDATA() )=Sales (Custom Region) =
CALCULATE(
[Total Sales],
Customers[Region] = CUSTOMDATA()
)
ยอดขายเฉพาะ Region ที่ตรงกับค่า Custom Data
CUSTOMDATA ใช้สำหรับการวิเคราะห์
ส่งค่าหรือคอลัมน์ข้อมูล
CUSTOMDATA คืนค่าข้อมูล Custom Data ที่ส่งจากแอปหรือ DirectQuery/Live Connection เข้าสู่โมเดล เหมาะสำหรับส่งค่า context เพิ่มเติมจากแอปภายนอกมาใช้ใน Measure หรือเงื่อนไขความปลอดภัย (RLS)