XML to DAX Converter

Transform XML data into DAX (Data Analysis Expressions) table format for Power BI and Analysis Services

About DAX

DAX (Data Analysis Expressions) is a formula language used in Power BI, Analysis Services, and Power Pivot. This tool converts XML data into DAX calculated table expressions with automatic type detection.

DAX Formats

  • DATATABLE(): Most common format with column names and types (recommended)
  • TABLE(): Simple format without column names
  • ROW() + UNION(): Dynamic format for building tables row by row

Supported Data Types

INTEGER - Whole numbers
DOUBLE - Decimal numbers
STRING - Text values
BOOLEAN - TRUE/FALSE values
DATETIME - Date and time values
BLANK() - Empty/null values

Features

  • Automatic Type Detection: Detects INTEGER, DOUBLE, STRING, BOOLEAN, and DATETIME
  • Multiple Formats: Choose from DATATABLE(), TABLE(), or ROW()+UNION()
  • BLANK() Support: Option to use BLANK() for empty cells
  • Custom Table Names: Specify your own table name
  • Column Name Sanitization: Ensures valid DAX identifiers

Example

Input XML:

<sales>
  <sale>
    <product>Laptop</product>
    <quantity>5</quantity>
    <revenue>4999.95</revenue>
  </sale>
</sales>

Output DAX (DATATABLE):

MyTable = DATATABLE(
	"product", STRING,
	"quantity", INTEGER,
	"revenue", DOUBLE
	{
		{"Laptop", 5, 4999.95}
	}
)

How to Use in Power BI

  1. Copy the generated DAX code
  2. Open Power BI Desktop
  3. Go to "Modeling" tab → "New Table"
  4. Paste the DAX code in the formula bar
  5. Press Enter to create the calculated table

Use Cases

  • Creating lookup tables in Power BI
  • Testing DAX formulas with sample data
  • Building dimension tables
  • Creating parameter tables
  • Prototyping data models
  • Educational and training purposes

FAQ

What XML structure works best with this converter?
Use a root element that contains repeating child elements such as <row>, <record>, or domain-specific elements (for example <sale>). Each child should contain elements that represent columns. Attributes are also supported and become additional columns.
How are empty or missing values handled in DAX?
Empty strings and values like "null" are converted to BLANK() when the BLANK option is enabled. Otherwise they become empty strings. This makes it easier to work with missing data in Power BI and Analysis Services.
Can I edit the generated DAX before using it?
Yes. You can paste the generated DAX into Power BI (New Table) or another DAX editor and adjust table names, column names, or data types before committing it to your model.
What happens if type detection is not what I expect?
The tool infers INTEGER, DOUBLE, BOOLEAN, DATETIME, or STRING based on the sample values in each column. If a column is misclassified, you can manually change the type in the generated DAX code (for example change STRING to INTEGER) before using it.