Forum Discussion

Shubhambh18's avatar
Shubhambh18
Frequent Visitor
1 year ago
Solved

How to Export Data from All Visuals in a Single Report Page at Once?

Hello everyone,   I’m trying to find a way to export all the data from multiple visuals at once. On one screen, I have around 8 visuals (bar and line charts), and currently, I have to export the da...
  • DataNinja777's avatar
    1 year ago

    Hi Shubhambh18 ,

     

    Power BI does not currently offer a built-in feature to export data from all visuals on a single report page at once. By default, each visual must be exported individually, which can be time-consuming when dealing with multiple visuals. While one workaround is to build a separate page with a table consolidating all the data, you're looking for a solution that allows extraction directly from the existing screen. Although Power Automate could automate this task, since you're not interested in that route, there are still a couple of manual but practical options available.

    One effective method is to use the Performance Analyzer in Power BI Desktop. You can open the Performance Analyzer from the "View" tab, click "Start Recording", and then refresh the visuals. This will capture the DAX queries for each visual. You can expand each visual's entry and click "Copy Query", then paste the queries into DAX Studio to run them. From DAX Studio, you can export the results to Excel or CSV, giving you access to the raw data behind each visual in one place.

    For example, if one of the visuals uses a measure like this:

    Total Sales = SUM(Sales[Amount])
    

    The Performance Analyzer will show the underlying DAX query used for that visual. You can run a similar query in DAX Studio like:

    EVALUATE
    SUMMARIZECOLUMNS(
        'Date'[Month],
        "Total Sales", [Total Sales]
    )
    

    If you're comfortable with DAX, another option is to recreate the visuals' logic using UNION or ADDCOLUMNS in a single table visual. For example:

    CombinedData =
    UNION(
        SELECTCOLUMNS('Sales', "Category", "Sales", "Value", [Total Sales]),
        SELECTCOLUMNS('Sales', "Category", "Profit", "Value", [Total Profit])
    )
    

    This approach lets you display all key metrics in one table visual, which can be exported in one go using the “Export data” option.

    There is no out-of-the-box feature or API that allows you to export all visuals’ data from the same screen with one click. But using Performance Analyzer with DAX Studio, or building a consolidated DAX table, are your best alternatives for now. If you'd like help reconstructing one of your visuals' DAX queries or building a consolidated export table, I can help with that too.

     

    Best regards,

     

  • Shubhambh18's avatar
    1 year ago

    DataNinja777  V-yubandi-msft 

     

    Apologies for taking some time to reply—I was busy trying and testing multiple approaches in the meantime.

    I have tried your solution, and it is working well. I used a similar approach to achieve the same end goal.

    Here is the step-by-step solution I implemented:

    Use Case

    To dynamically export data based on different fields selected by the user.

     

    Step 1: Create a Dummy Table

    Create a dummy table to store all the FieldNames that will be used to dynamically add or remove columns in the exported dataset. Use this table as a slicer on the export page.

    DAX
    FieldSelection = DATATABLE(
        "FieldName", STRING,
        {
            {"Column1"},
            {"Column2"},
            {"Column3"}
        }
    )
     

    Step 2: Configure the Matrix

    Add a matrix visual and use the newly created dynamic fields (FieldName) to append or remove the columns from the matrix. Use static rows from your dataset in the matrix rows. Here's the DAX measure for the dynamic values:

    DAX
    DynamicData = 
    VAR SelectedFields = VALUES(FieldSelection[FieldName]) 
    RETURN 
    IF(
        ISFILTERED(FieldSelection[FieldName]), -- Ensure slicer has an active filter
        SWITCH(
            TRUE(),
            "Column1" IN SelectedFields, masterTable[Column1], -- Columns to be displayed
            "Column2" IN SelectedFields, masterTable[Column2],
            "Column3" IN SelectedFields, masterTable[Column3],
            BLANK()
        ),
        BLANK() -- Show blank if no fields are selected
    )
     

    Step 3: Add an Error Message

    To handle cases where no fields are selected, add a measure to display an error message:

    DAX
    SelectionCheck = 
    IF(
        COUNTROWS(VALUES(FieldSelection[FieldName])) = 0, 
        "Please select at least one field",
        ""
    )

    Outcome

    By interacting with the slicer, I was able to dynamically add or remove data fields in the matrix and export the customized data.

    Thank you all for your suggestions! Feel free to accept this as a solution if it helps.

    Cheers!