---
title: LINESTX – ฟังก์ชัน DAX
url: https://www.thepexcel.com/functions/dax/statistical/linestx-dax/
type: function-explainer
program: DAX
syntax: "LINESTX(<Table>, <DependentExpression>, <IndependentExpression>, [...])"
date: 2025-12-15
updated: 2025-12-17
scores:
  popularity: 3
  difficulty: 4
  usefulness: 3
---

# LINESTX – ฟังก์ชัน DAX

> ทำการวิเคราะห์การถดถอยเชิงเส้น (Linear Regression)

## คำอธิบาย

LINESTX ทำการวิเคราะห์การถดถอยเชิงเส้น (Linear Regression) โดยใช้วิธี Least Squares เพื่อหาเส้นตรงที่เหมาะสมที่สุดกับข้อมูล ส่งกลับตารางสถิติที่ประกอบด้วย Slope Intercept Standard Error R-squared และสถิติอื่น ๆ ใช้สำหรับสร้างแบบจำลองการทำนาย (Predictive Model) และวิเคราะห์ความสัมพันธ์ระหว่างตัวแปร

## Syntax

```excel
LINESTX(&lt;Table&gt;, &lt;DependentExpression&gt;, &lt;IndependentExpression&gt;, [...])
```

## Arguments

| Name | Required | Type | Default | Description |
| --- | --- | --- | --- | --- |
| Table | Yes | table | ไม่มี | ตารางข้อมูล |
| DependentExpression | Yes | expression | ไม่มี | ตัวแปรตาม (Y) - ค่าที่ต้องการทำนาย |
| IndependentExpression | Yes | expression | ไม่มี | ตัวแปรอิสระ (X) - ตัวแปรทำนาย (สามารถหลายตัว) |

## ตัวอย่าง

### 1. ทำนายราคาจากขนาดอสังหาริมทรัพย์

```excel
LINESTX(Properties, Properties[Price], Properties[Size])
```

**ผลลัพธ์:** `ตารางสถิติ 10 คอลัมน์`

วิเคราะห์ความสัมพันธ์ระหว่าง Size (X) กับ Price (Y) ได้ Slope Intercept R²

### 2. ถดถอยหลายตัวแปร

```excel
LINESTX(Properties, Properties[Price], Properties[Size], Properties[Rooms], Properties[Age])
```

**ผลลัพธ์:** `ตารางสถิติ 10 คอลัมน์`

ใช้ 3 ตัวแปร (Size, Rooms, Age) ทำนาย Price ได้ Coefficients สำหรับแต่ละตัว

### 3. ดึง R² สำหรับความดี

```excel
INDEX(LINESTX(...), 3, 1)
```

**ผลลัพธ์:** `0.85`

R² = 0.85 หมายว่า 85% ของความแปรปรวนใน Y อธิบายได้จาก X

## หมายเหตุเพิ่มเติม

⭐ สำหรับ Statistical Modeling | 💡 ต้องใช้ INDEX ดึงค่า | 🔗 สำหรับ Predictive Analytics

## คำถามที่พบบ่อย

**Q: LINESTX ส่งค่าอะไร**

ตารางที่มี Slopes Intercepts Standard Errors R² F-statistic Degrees of freedom ต้องใช้ INDEX ดึงค่าที่ต้องการ

**Q: ใช้สำหรับอะไร**

สร้าง Predictive Models ทำนายค่า Y จาก X และวัด Fit Quality ของโมเดล

**Q: ระวังอะไร**

ตาราง LINESTX มี 10 คอลัมน์ ต้องหา Column Index ที่ถูก ไม่ค่อยทำให้ error ถ้าไม่ระวัง

## ฟังก์ชันที่เกี่ยวข้อง

- [AVERAGE – คำนวณค่าเฉลี่ยเลขคณิตจากคอลัมน์ตัวเลข](https://www.thepexcel.com/functions/dax/aggregation/average-dax/)
- [STDEVX.P – ฟังก์ชัน DAX](https://www.thepexcel.com/functions/dax/statistical/stdevx-p-dax/)
- sumproduct-dax

## แหล่งข้อมูลเพิ่มเติม

- [DAX.Guide: LINESTX](https://dax.guide/linestx/) _(documentation)_
- [Microsoft Learn](https://learn.microsoft.com/en-us/dax/function/linestx) _(documentation)_

---

_Source: [https://www.thepexcel.com/functions/dax/statistical/linestx-dax/](https://www.thepexcel.com/functions/dax/statistical/linestx-dax/)_
