Forum Discussion

enoch99's avatar
enoch99
Helper I
1 year ago
Solved

Transform row values to columns and Table Visual with dynamic number of columns

Greetings all,   I have a data like below, and I wanted to display the Product Category values as column with each brand listed as a comma separated:   Warehouse Product Category Brand W-...
  • rajendraongole1's avatar
    1 year ago

    Hi enoch99 - If you're using Power BI Premium or Power BI Desktop with field parameters enabled, you can dynamically manage fields. Here’s how:

    Enable Field Parameters:
    Go to Modeling > New Parameter > Fields.
    Create a field parameter that includes Product Category.
    Use in Visual:
    Add the parameter to your visual and select the dynamic fields you want to display. The parameter will update with any new fields.

    Solved: Field Parameter with Matrix Visual for dynamic col... - Microsoft Fabric Community

    Solved: Dynamic column selection for matrix visual - Microsoft Fabric Community

  • Anonymous's avatar
    Anonymous
    1 year ago

    Thanks for the reply from rajendraongole1, please allow me to provide another insight.

    Hi enoch99 ,

    If you accept to display the data in a matrix visual, you can try the following steps.

    Not pivoting in Power Query.
    Create a measure to be used to display the brand.

    Brand_ = 
    IF(COUNTROWS('Table')>1,CONCATENATEX('Table','Table'[Brand],","),MAX('Table'[Brand]))


    Use the Product Category column to create a field parameter table.

     

    Create a matrix visual using the parameter field and the measure.

     

    Now, when you add a new product category, it will automatically appear in the matrix visual.

     

    Please see the attached pbix for reference.

    Best Regards,
    Dengliang Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.