Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Jiny
Frequent Visitor

Getting error on exporting UNDERLYING data of embedded PowerBI report

Manually exporting data from the report opens data.xlsx file with below data

Detail_CountGitHubVersionControlledApps

Applied filters:
Planned_D_Date_Flag_c is Y
 
651
 

 

I am able to retrieve visuals on the page etc. in but not the underlying data from the embedded report

 

Please see python code used below:

#### Please note I tried using SUMMARIZED instead of UNDERLYING and still same error thrown for 'underlyingData'

exported_data = report.export_visual_data(page_name=report_name, visual_name=visual_name, export_data_type=models.ExportDataType.UNDERLYING)
print(exported_data)

 

Throws below printed error stack trace:

 

Also tried below code where it didn't even throw any error but just hung:

exported_data = report.export_visual_data(page_name=report_name, visual_name=visual_name, rows=1, export_data_type=models.ExportDataType.UNDERLYING.value)

 

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[114], line 15
     10 print(visual_name)
     12 #exported_data = report.export_visual_data(report_page_id, visualization_id, rows=1)
     13 #print(exported_data)
---> 15 exported_data = report.export_visual_data(page_name=report_name, visual_name=visual_name, rows=1, export_data_type=models.ExportDataType.UNDERLYING)
     16 print(exported_data)
     18 try:

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\powerbiclient\report.py:379, in Report.export_visual_data(self, page_name, visual_name, rows, export_data_type)
    376     raise Exception(self.REPORT_NOT_EMBEDDED_MESSAGE)
    378 # Start exporting data on client side
--> 379 self._export_visual_data_request = {
    380     'pageName': page_name,
    381     'visualName': visual_name,
    382     'rows': rows,
    383     'exportDataType': export_data_type
    384 }
    386 # Check if ipython kernel is available
    387 if get_ipython():
    388     # Wait for client-side to send visual data

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\traitlets\traitlets.py:732, in TraitType.__set__(self, obj, value)
    730     raise TraitError('The "%s" trait is read-only.' % self.name)
    731 else:
--> 732     self.set(obj, value)

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\traitlets\traitlets.py:706, in TraitType.set(self, obj, value)
    705 def set(self, obj, value):
--> 706     new_value = self._validate(obj, value)
    707     try:
    708         old_value = obj._trait_values[self.name]

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\traitlets\traitlets.py:740, in TraitType._validate(self, obj, value)
    738     value = self.validate(obj, value)
    739 if obj._cross_validation_lock is False:
--> 740     value = self._cross_validate(obj, value)
    741 return value

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\traitlets\traitlets.py:746, in TraitType._cross_validate(self, obj, value)
    744 if self.name in obj._trait_validators:
    745     proposal = Bunch({"trait": self, "value": value, "owner": obj})
--> 746     value = obj._trait_validators[self.name](obj, proposal)
    747 elif hasattr(obj, "_%s_validate" % self.name):
    748     meth_name = "_%s_validate" % self.name

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\traitlets\traitlets.py:1233, in EventHandler.__call__(self, *args, **kwargs)
   1231 """Pass `*args` and `**kwargs` to the handler's function if it exists."""
   1232 if hasattr(self, "func"):
-> 1233     return self.func(*args, **kwargs)
   1234 else:
   1235     return self._init_call(*args, **kwargs)

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\powerbiclient\report.py:163, in Report._valid_export_visual_data_request(self, proposal)
    160         raise TraitError('Invalid rows ', proposal['value']['rows'])
    161     if type(proposal['value']['exportDataType']) is not int:
    162         raise TraitError('Invalid exportDataType ',
--> 163                          proposal['value']['underlyingData'])
    165 return proposal['value']

KeyError: 'underlyingData'

 

4 REPLIES 4
Anonymous
Not applicable

Hi  @Jiny ,

 

Sorry for only replying now, I can't reproduce your problem, can you provide me with the Python code you used?

 

 

Best Regards,

Liu Yang

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

Jiny
Frequent Visitor

Hi @Liu ,

SAME ERROR. NO SOLUTION.

 

I have checked all these options and the visual name as well I have tested and retrieved these individually and verified it is correct, I even removed the rows parameter as it defaults to max and still its the same error.

Anonymous
Not applicable

Hi  @Jiny ,

 

According to the error message, it is possible that the data or parameters passed to the function or method do not match the expected structure.

You can try checking the following operations:

Ensure that the Power BI Embedded environment is correctly configured to support data export operations, and that appropriate permissions and settings are enabled in the Power BI service to allow the export of underlying data.

Ensure that the parameter settings are correct, and that the report, page, and visual object names are specified correctly. A mismatch in these names could cause problems when attempting to export data.

 

Is your Power BI Desktop the latest version, if not, you can update to the latest version.

Download Power BI Desktop from Official Microsoft Download Center

 

This is the related document, you can view this content:

Issues exporting Power BI data from embedded reports in Teams - Microsoft Community Hub

javascript - PowerBI Embedded API: "too few fields" error when trying to export data - Stack Overflo...

Export Power BI embedded analytics reports API - Power BI | Microsoft Learn

 

Best Regards,

Liu Yang

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

Hi @Liu ,

SAME ERROR.

 

I have checked all these options and the visual name as well I have tested and retrieved these individually and verified it is correct, I even removed the rows parameter as it defaults to max and still its the same error.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.