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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
stribor45
Post Prodigy
Post Prodigy

How to debug in Power Bi Desktop

Is there a way to debug within Power Bi Desktop? I am not familiar with M language and would like to manipulate data returned from API call before this is sent to the table but I have no idea what I am doing and what the data look like. I would like to add up some numbers returned from API call and maybe keep only limited the data. Is there something similar to system.out(myVariable) OR console.log(myVariable) so I can see what I am getting returned?

2 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

In Power Query you break the transforms into small steps. You can examine the output of each step by selecting it in the "Applied Steps"  section.

You can click next to the links in your result tables to see a preview of the data behind them.
You can invoke functions and see their output based on sample parameters you provide.
Power Query allows you to throw errors if you arrive at code junctions you don't expect.

For API calls you can use tools like Postman to test them out before implementing them in Power Query.

 

Above all - invest time learning M. It is time well spent.

View solution in original post

Let's say you have a function that cubes a value.

 

(val)=> val*val*val

when you click on the query for that function you see its details and parameters

lbendlin_0-1680638314665.png

Now you can "test" it by invoking with a sample value.

lbendlin_1-1680638362905.png

 

 

View solution in original post

4 REPLIES 4
stribor45
Post Prodigy
Post Prodigy

Thank you for this. I am working now on breaking up larger code into smaller pieces and your response helped me. 

lbendlin
Super User
Super User

In Power Query you break the transforms into small steps. You can examine the output of each step by selecting it in the "Applied Steps"  section.

You can click next to the links in your result tables to see a preview of the data behind them.
You can invoke functions and see their output based on sample parameters you provide.
Power Query allows you to throw errors if you arrive at code junctions you don't expect.

For API calls you can use tools like Postman to test them out before implementing them in Power Query.

 

Above all - invest time learning M. It is time well spent.


@lbendlin wrote:

You can invoke functions and see their output based on sample parameters you provide.

 


How would you invoke the function with sample parameters and see its output? I test my calls in Postman and I can click on the links and see records details once my code is executed. I am used to be able to learn language by doing small steps and seeing outputs either in the browser console or on Windows command prompt

Let's say you have a function that cubes a value.

 

(val)=> val*val*val

when you click on the query for that function you see its details and parameters

lbendlin_0-1680638314665.png

Now you can "test" it by invoking with a sample value.

lbendlin_1-1680638362905.png

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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