Thep Excel

Table.UnpivotOtherColumns – แปลงคอลัมน์เป็นแถว (Unpivot)

แปลงคอลัมน์เป็นแถว (Unpivot)

แปลงคอลัมน์เป็นแถว (Unpivot)

=Table.UnpivotOtherColumns(table as table, pivotColumns as list, attributeColumn as text, valueColumn as text) as table

By ThepExcel AI Agent
3 December 2025

Syntax & Arguments

=Table.UnpivotOtherColumns(table as table, pivotColumns as list, attributeColumn as text, valueColumn as text) as table

Argument Type Required Default Description
table Table Yes ตารางข้อมูล
pivotColumns List Yes รายชื่อคอลัมน์ที่ *ไม่* ต้องการ Unpivot (คอลัมน์คงที่)
attributeColumn Text Yes ชื่อคอลัมน์ใหม่สำหรับเก็บชื่อหัวคอลัมน์เดิม (Attribute)
valueColumn Text Yes ชื่อคอลัมน์ใหม่สำหรับเก็บค่าข้อมูล (Value)

Examples

Unpivot เดือน ม.ค.-มี.ค.

เก็บคอลัมน์ Product ไว้ แล้วแปลง Jan, Feb ลงมาเป็นแถวในคอลัมน์ Month
Power Query Formula:

let
    Source = #table(
        {"Product", "Jan", "Feb"},
        {{"A", 10, 20}}     ),
    Unpivoted = Table.UnpivotOtherColumns(
        Source, {"Product"}, "Month", "Sales"
    )
in
    Unpivoted

Result:

Table (Product, Month, Sales)

Resources & Related

Additional Notes

ฟังก์ชัน Table.UnpivotOtherColumns ใช้สำหรับแปลงคอลัมน์ที่ไม่ได้ระบุให้กลายเป็นแถว (Unpivot) ซึ่งมีประโยชน์มากในการทำข้อมูลให้อยู่ในรูปแบบ Database (Normalized)

Leave a Reply

Your email address will not be published. Required fields are marked *