Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
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
Solved! Go to 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.
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)}
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.
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.
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
Proud to be a Super User!
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
Proud to be a Super User!
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 48 | |
| 40 | |
| 37 | |
| 20 | |
| 16 |
| User | Count |
|---|---|
| 69 | |
| 67 | |
| 32 | |
| 27 | |
| 26 |