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
luisJarmanCP
New Member

Unable to Add 'Year' HierarchyLevel to DataField with Power BI JS Client

Hello Community,

I'm currently developing a project with the Power BI JavaScript Client and I've encountered an issue that I could use some assistance with.

To provide some context, I am working with a dataset that includes several tables. Among these tables, there's one titled "Product Daily Prices". This table has a column named "Price Date" which contains a "Date Hierarchy". This hierarchy includes levels for Year, Quarter, Month, and Day.

luisJarmanCP_0-1690365634069.png

 

I have been attempting to utilize the Report Authoring SDK to append the "Year" hierarchy level with the following code:

 

await visual.addDataField('Category', {
table: 'Product Daily Prices',
hierarchy: 'Price Date',
hierarchyLevel: 'Year',
$schema: "http://powerbi.com/product/schema#hierarchyLevel",
});

 

I also tried to adjust the hierarchy parameter in my code to 'Date Hierarchy', to see if this was the cause of the issue:

await visual.addDataField('Category', {
table: 'Product Daily Prices',
hierarchy: 'Date Hierarchy',
hierarchyLevel: 'Year',
$schema: "http://powerbi.com/product/schema#hierarchyLevel",
});

However, both of these code snippets result in the same error:

{
"message": "FailedToAddDataField",
"detailedMessage": "Failed to add data field to role"
}

 

I have been unable to find the cause of this problem and would appreciate any guidance on resolving this. Has anyone else experienced this issue when attempting to add a hierarchy level to a data field with the Power BI JS Client?

Thanks in advance for your help.

Best regards,
Luis

1 REPLY 1
Allen_Tan
Regular Visitor

Have encounter the same problem too, have you found the solution yet?

Helpful resources

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

June 2025 community update carousel

Fabric Community Update - June 2025

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