HTML to DAX Converter

Transform HTML tables into DAX code for Power BI

About HTML to DAX Converter

Convert HTML tables into DAX (Data Analysis Expressions) code for Microsoft Power BI, Analysis Services, and Power Pivot. This HTML to DAX converter helps you quickly turn table data from a web page or report into DATATABLE definitions, calculated tables, or ready-made measures.

Key Features

  • DATATABLE generation: Create static DAX DATATABLE expressions from HTML tables.
  • Calculated table output: Build SELECTCOLUMNS-based calculated table expressions from sample data.
  • Measure templates: Generate common measures such as COUNTROWS, DISTINCTCOUNT, filtered counts, and rankings.
  • Header detection: Use <thead> or header rows as column names.
  • Column sanitization: Clean column names by removing invalid characters and replacing spaces with underscores.
  • String escaping: Escape quotes so DAX strings compile correctly.
  • Custom table names: Name your DAX tables to match your Power BI data model.

How to Convert HTML Tables to DAX

  1. Paste or upload HTML: Insert the HTML containing your <table> or upload an .html file.
  2. Choose output format: Select DATATABLE, Calculated Table, or Measures based on what you need.
  3. Set table name: Provide a DAX table name such as SalesData or LookupProducts.
  4. Inspect the DAX: Review the generated code and confirm column names and values.
  5. Copy to Power BI: Paste the DAX into a new table/measure in Power BI Desktop and validate it.

Examples

Example 1: Static reference table (DATATABLE)

A small HTML table of regions and codes becomes a DATATABLE you can paste directly into your model:

Regions = DATATABLE(
    "Region", STRING,
    "Code", STRING,
    {
        {"North", "N"},
        {"South", "S"}
    }
)

Example 2: Measures for an imported table

Using the Measures output mode, the tool produces templates like:

Total Sales =
COUNTROWS('HTMLData')

Distinct Product Count =
DISTINCTCOUNT('HTMLData'[Product])

Output Formats

  • DATATABLE: Best for small, static reference tables embedded directly in your model.
  • Calculated Table: Useful when you want a readable sample table that you can further extend.
  • Measures: Great for quickly bootstrapping analysis on top of an existing HTML-derived table.

DAX Syntax & Best Practices

The generated DAX is designed to be readable and safe:

  • Column names are sanitized to remove unsupported characters.
  • String values are double-quoted and internal quotes are escaped.
  • Table names are used consistently inside single quotes when required.
  • Comments highlight when only a subset of rows is included for readability.

FAQ

How many rows are included in the Calculated Table output?

For readability, only the first few rows (e.g., first 5) are included in the calculated table sample. You can extend or replace the data once you have the structure in place.

Can I use numeric columns instead of strings?

This tool outputs everything as STRING for safety. After pasting into Power BI, you can change column data types or manually adjust the DAX to use INTEGER/DECIMAL types where appropriate.

What if my HTML table has no header row?

If no header is found, generic column names such as Column1, Column2 are generated and sanitized for DAX. You can rename them inside Power BI afterward.

Is any of my HTML or data uploaded?

No. The HTML to DAX conversion runs entirely in the browser. Your HTML, DAX, and data stay on your machine.

Privacy & Security

Parsing and DAX generation are fully client-side. Nothing is stored or transmitted, making this HTML to DAX converter safe for internal reports and sensitive datasets.