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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
jaryszek
Power Participant
Power Participant

How to apply dax as measure on specific visual using javascriptapi?

Hi Guys,

How to apply dax as measure on specific visual using javascriptapi?
I know that there is execute queries rest api to execute dax. 

But how to apply dax on already existing visual?

Best,
Jacek

1 ACCEPTED SOLUTION
v-tsaipranay
Community Support
Community Support

Hi @jaryszek ,
Thank you for posting in the Microsoft Fabric Community.

 

Currently, the Power BI JavaScript API does not support dynamically creating or applying new DAX measures to existing visuals within an embedded report. However, you can assign pre-defined measures to visuals using the API's setDataFields() method. For executing custom DAX queries, consider using the Execute Queries REST API, which allows running DAX queries against a dataset and retrieving results.

Please refer to the following documentation for more information:

Datasets - Execute Queries - REST API (Power BI Power BI REST APIs) | Microsoft Learn

For dynamic measure selection, it's advisable to predefine multiple measures in your dataset and enable users to choose among them as needed.

 

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

 

Thankyou

View solution in original post

2 REPLIES 2
jaryszek
Power Participant
Power Participant

Thank you very much

v-tsaipranay
Community Support
Community Support

Hi @jaryszek ,
Thank you for posting in the Microsoft Fabric Community.

 

Currently, the Power BI JavaScript API does not support dynamically creating or applying new DAX measures to existing visuals within an embedded report. However, you can assign pre-defined measures to visuals using the API's setDataFields() method. For executing custom DAX queries, consider using the Execute Queries REST API, which allows running DAX queries against a dataset and retrieving results.

Please refer to the following documentation for more information:

Datasets - Execute Queries - REST API (Power BI Power BI REST APIs) | Microsoft Learn

For dynamic measure selection, it's advisable to predefine multiple measures in your dataset and enable users to choose among them as needed.

 

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

 

Thankyou

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.