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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Schizzomarino
Advocate I
Advocate I

Problem using "d3-array".rollup (and it spread argument) in a Power BI Custom Visual

Hello to you all,

I am hoping someone will have a solution for a problem I have encountered using "d3-array" in a custom visual for Power BI.
I have been using d3 v5 as it's got really nice data munching functions that keep my code clean and give good performance; but some of these are now giving me trouble: the rollup function from "d3-array" in particular. Here a description of my situation:

 
After importing d3 and rollup from d3-array (as rollup), and installing the typescript definitions, when I try to use rollup with two keys, i.e.:
Array.from(rollup(data, ([d]) => d.value, d => +d.date, d => d.name))
I get the following error for the above line: "Expected 3 arguments, but got 4"
If I remove the second or first key the above works, but then I don't get the Map I am looking for and would have liked to keep the above code as it is just so clean...
 

A small part of the data for clarity:

[{"date":36526,"name":"Coca-Cola","category":"Beverages","value":72537},{"date": 36526,"name": "Microsoft","category": "Technology", "value":70196},...]

Any typescript advice on how to get this to work?

Notes:
Rollup takes arguments in this form: (valuesreduce, ...keys); so that keys can be multiple. 

This works perfectly fine in a standard web page with the same d3 and d3-array libraries.

Thanks in advance for any advice on the above

Daniel

1 ACCEPTED SOLUTION
Schizzomarino
Advocate I
Advocate I

I have just realised I put this in the wrong place (should be within "Custom Visuals Development Discussion"

So I will duplicate this there, sorry... I am a newbie to the board

View solution in original post

1 REPLY 1
Schizzomarino
Advocate I
Advocate I

I have just realised I put this in the wrong place (should be within "Custom Visuals Development Discussion"

So I will duplicate this there, sorry... I am a newbie to the board

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.