Forum Discussion

smpa01's avatar
smpa01
Community Champion
3 years ago
Solved

Debugging TOJSON

Is there a reason why dynamic Max Rows in TOJSON does not work?

 

Table = {TOJSON(GENERATESERIES(1, 100000,1),-1)}

 

opposed to fully working TOCSV

Table = {TOCSV(GENERATESERIES(1, 100000,1),-1,"")}

 

 

 

AlexisOlson bcdobbs CNENFRNL 

 

 

  • There was a bug when MaxRows is -1 that was fixed recently. You need to wait for the next Desktop release. Unfortunately dynamic expression for the MaxRows parameter isn't supported.

6 Replies

  • Hi smpa01 

     

    Not sure why you refer to MaxRows being dynamic - you've hardcoded -1 in that formula?

     

    But I am getting an error when using a negative value for MaxRows, even though it says you can do this.  Is this the problem you are having?

     

    Regards

     

    Phil

    • smpa01's avatar
      smpa01
      Community Champion
      • I want to include all rows and by hardcoding -1, I am testing if it works on all rows. As per dax studio, a negative number should include all rows. Works for TOCSV not for TOJSON
  • It seems like a bug to me since it gives the following error rather than something more descriptive but, as PhilipTreacy mentioned, the official documentation doesn't say that it's supported.

     

     

    Interstingly, dax.do doesn't throw an error for the query

     

    EVALUATE {TOJSON(GENERATESERIES(1, 100000,1),-1)}

     

    • smpa01's avatar
      smpa01
      Community Champion

      I have an application where it can become extremely useful.

      I really don't care about -1. I only want an expression/dynamic expression to include all rows.

       

      BTW it does not work too.

      jeffrey_wang  can you shed some light if it is doable.

       

      • jeffrey_wang's avatar
        jeffrey_wang
        Power BI Team

        There was a bug when MaxRows is -1 that was fixed recently. You need to wait for the next Desktop release. Unfortunately dynamic expression for the MaxRows parameter isn't supported.