Forum Discussion
How to display rows from datasets with variable schema in a single table visual?
- Anonymous8 months ago
Hi Divyanshu1504 ,
Thank you for reaching out to the Microsoft Fabric Community Forum. Thank you danextian and HarishKM for your helpful response.
Power BI table visuals require a fixed schema, so columns cannot be created dynamically at runtime. The supported way to meet your requirement is to use Field Parameters. Define all possible columns once in a field parameter, then use a Dataset–Column mapping table to control which columns are visible based on the selected dataset. When a user selects Dataset A or B, only the mapped columns appear in the table. This approach simulates dynamic columns and is the simplest and recommended workaround in Power BI currently.
Thank you.
Divyanshu1504 Hey,
I will refer below suggestion for this.
What’s possible (and What I will use in this case)
- Use an EAV/pivot-by-attribute pattern with a Matrix visual
- In Snowflake, FLATTEN the JSON into key/value rows
- Fields: dataset_name, record_id, attribute, value_text, value_num, value_dt
- Example: select dataset_name, record_id, f.key::string as attribute, to_varchar(f.value) as value_text, try_to_number(f.value) as value_num, try_to_timestamp(f.value) as value_dt from raw t, lateral flatten(input => t.payload) f;
- Create an Attribute Meta table: attribute, dataset_name, display_name, data_type, column_order, format
- Build a Matrix in Power BI:
- Rows: record_id
- Columns: Attribute Meta[display_name] (sort by column_order)
- Values: one measure that formats output based on Attribute Meta[data_type], e.g. SWITCH to pick value_num/value_dt/value_text and FORMAT accordingly
- Add a slicer for dataset_name. Columns will change automatically with the selected dataset’s attributes
Why this works
- Power BI visuals need a fixed field list, but a Matrix with “Columns = attribute” effectively creates dynamic columns driven by data (no need to predefine all columns)
Few more sugestion
- Field Parameters can swap a predefined set of columns/tables, but won’t auto-adapt to new attributes/datasets (maintenance overhead)
- If you must export with fully dynamic columns, use Paginated Reports: hide/show columns by parameter and render only those present
- Keep types consistent via Attribute Meta. Example measure:
- Display Value =
VAR dt = SELECTEDVALUE('Attribute Meta'[data_type])
RETURN SWITCH(dt,
"NUMBER", FORMAT(MAX('Fact'[value_num]), SELECTEDVALUE('Attribute Meta'[format])),
"DATE", FORMAT(MAX('Fact'[value_dt]), "yyyy-MM-dd"),
MAX('Fact'[value_text])
)
- Performance: prefilter in Snowflake (dataset, date), ensure one row per record_id+attribute, and use DirectQuery only if necessary
Alternatives
- Show raw JSON using a JSON Viewer custom visual for drill-through details
- Paginated Report for email/export scenarios with truly dynamic columns
Bottom line for your problem
a) Best-practice in Power BI is: flatten JSON to EAV in Snowflake → Matrix visual with attribute on Columns → one formatting measure → dataset slicer for dynamic structure.
Thanks
Haish K
If I resolve your issue. Kindly give kudos to this post and accept it as a solution so other can refer this.
- Divyanshu15048 months agoFrequent Visitor
Thanks for suggestion.
Lets make it simple.
Below is requirement, can you suggest a way to solve this.