Forum Discussion

stribor45's avatar
stribor45
Post Prodigy
3 years ago
Solved

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?

  • 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's avatar
    lbendlin
    3 years ago

    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

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

     

     

4 Replies

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

    • stribor45's avatar
      stribor45
      Post Prodigy

      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

      • lbendlin's avatar
        lbendlin
        Super User

        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

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

         

         

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