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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
smpa01
Super User
Super User

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,"")}

 

 

smpa01_0-1680144406009.png

 

@AlexisOlson @bcdobbs @CNENFRNL 

 

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
1 ACCEPTED SOLUTION

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.

View solution in original post

6 REPLIES 6
AlexisOlson
Super User
Super User

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.

 

AlexisOlson_0-1680192032771.png

 

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

 

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

 

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.

smpa01_0-1680196030784.png

@jeffrey_wang  can you shed some light if it is doable.

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

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.

PhilipTreacy
Super User
Super User

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



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


  • 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
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Hi @smpa01 

 

As I said, I also get an error when using -1 for MaxRows.  But the official Microsoft documentation makes no mention of -1 as being a valid value

 

TOJSON function (DAX) - DAX | Microsoft Learn

 

regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

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