Forum Discussion

Divyanshu1504's avatar
Divyanshu1504
Frequent Visitor
8 months ago
Solved

How to display rows from datasets with variable schema in a single table visual?

Hi all,

 

I’m looking for guidance on how to display row-level data in Power BI when the underlying datasets have different schemas.

Scenario

I have multiple datasets coming from the same source system. Each dataset contains record-level data, but the number of columns and the column names vary between datasets.

Example:

  • Dataset A → 15 columns

  • Dataset B → 40 columns

  • Dataset C → 120 columns

The number of datasets may continue to grow over time.

 Data Structure

Data is stored in Snowflake, and row-level records are currently stored in JSON format due to schema differences.

What I Want to Achieve

I want to show these records in one Power BI table visual, where the user selects a dataset and Power BI automatically displays the correct set of columns for that dataset.

The goal:

  • Single page

  • Single table visual

  • Dynamic structure

  • Columns change based on dataset selection

The Challenge

Power BI table visuals require a fixed schema.
Since each dataset has a different structure, it isn’t clear how to align them into a single dynamic table visual without flattening or pivoting everything into a universal schema — which isn’t practical.

Question

Is there a recommended approach or best practice for:

  • Handling variable schemas in Power BI

  • Loading JSON records with different column sets

  • Dynamically adjusting a table visual based on a user selection

  • Or alternative design ideas like paginated reports or semantic models

Any suggestions, examples, or references would be helpful.

Thank you!

powerbiquestion PowerBiDax Anonymous 

  • Anonymous's avatar
    Anonymous
    8 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.

7 Replies

  • Divyanshu1504 

    You mean with a slicer selection? 

    You can combine everything into a single table that includes all columns from all datasets, though some rows will have blanks where certain columns don’t apply. Add all columns to a field parameter and create another table to manage column visibility. This table will need a many-to-many, single-direction relationship with the field parameter table. The resulting view table will look like this.

    Dataset Column
    Dataset A Column1
    Dataset A Column2
    Dataset A Column3
    Dataset B Column2
    Dataset B Column3
    Dataset C Column1
    Dataset C Column2
    Dataset C Column3
    Dataset C Column4

     

    After setting up everything, the output would be somehow look like the image below.

    You might have to update this view table as new columns are added to/remove from the datasets. 

    Another option is to unpivot all columns except the dataset column names, but this approach isn’t recommended because it can mix up data types, create complex relationships, and lead to complicated DAX.

     

    • Divyanshu1504's avatar
      Divyanshu1504
      Frequent Visitor

      Thanks, 
      Can you make it simple.
      Below is my requirement in simple terms. can you provide the solution?

       

  • 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.

    • Divyanshu1504's avatar
      Divyanshu1504
      Frequent Visitor

      Thanks for suggestion. 
      Lets make it simple.

      Below is requirement, can you suggest a way to solve this.

       

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Divyanshu1504 ,

     

    We haven’t received an update from you in some time. Could you please let us know if the issue has been resolved?
    If you still require support, please let us know, we are happy to assist you.

     

    Thank you.

  • Anonymous's avatar
    Anonymous
    Not applicable

    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.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Divyanshu1504 ,

     

    I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.

     

    Thank you.