Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi there,
Ive just created two simple y and x-axes
The x-axis works fine in both, powerbi online and desktop version.
But if you take a look to the y-axis, the scaling fails however in power bi desktop. And this is something i dont understand why because i didnt do anything much different than for the x-axis.
To create the domains im using the min/max-functions from the d3 library.
Possible bug?
For any solution i would be very thankful!
Solved! Go to Solution.
This is expected behavior as Power BI aggregates the same values by using an algorithm such as Sum, Count, etc.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
UPDATE:
Ok there has to be something wrong with d3.max
Because if i change from d3.max to d3.median, it shows me 16 on both (online and desktop), which is correct.
That means it actually has access to all values in the array.
So can it be a bug?
I also used map, but still, the max value in desktop-version shows 9...
.domain([0, d3.max(viewModel.dataPoints.map (function (d) { return <number>d.anzahlKostenstellen; }))]);
UPDATE2:
The problem is not d3.max.
I tried to solve it by only using a loop and check each value if its greater than max
let max = 0;
for (let i = 0, len = 100; i < len; i++) { if (((viewModel.dataPoints.map(function (d) { return <number>d.anzahlKostenstellen; }))[i]) > max) { max = ((viewModel.dataPoints.map(function (d) { return <number>d.anzahlKostenstellen; }))[0]); } }
let y = d3.scale.linear() .range([ gHeight, 0 ]) .domain([0, max]);
But still i get 2 different values in powerbi desktop and online app...
From this point i really dont know why power bi is doing this. Does anybody have an idea?
Can you confirm that anzahlKostenstellen is always a number?
What version of d3 do you?
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
anzahlKostenstellen is a PrimitiveValue but is used always as a <number>anzahlKostenstellen
I figured out what the problem was but still couldnt solve it.
In my table are two identical names.
For example if this is my original Table:
verantwortlicher gesamtKosten anzahlKostenstellen
Peter 200 3
Peter 500 5
Martin 100 1
Tom 400 9
It categorizes them together, which makes sense because my verantwortlicher is set to "Grouping" in my capabilities,json:
verantwortlicher gesamtKosten anzahlKostenstellen
Peter 200 3
Peter 500 5
Martin 100 1
Tom 400 9
But i dont want PBI to group it together. How can i do this?
My capabilities.json
{ "dataRoles": [ { "displayName": "Verantwortlicher", "name": "verantwortlicher", "kind": "Grouping" // If i change this to "Measure", nothing works... }, { "displayName": "Gesamtkosten", "name": "gesamtKosten", "kind": "Measure" }, { "displayName": "Anzahl Kostenstellen", "name": "anzahlKostenstellen", "kind": "Measure" } ], "dataViewMappings": [ { "table": { "rows": { "select": [ { "for": { "in": "verantwortlicher" } }, { "for": { "in": "gesamtKosten" } }, { "for": { "in": "anzahlKostenstellen" } } ] } } } ], ...
My Interface:
interface ChartDataPoint { verantwortlicher: string; gesamtKosten: PrimitiveValue; anzahlKostenstellen: PrimitiveValue; color: string; selectionId: ISelectionId; };
My visualTransform:
function visualTransform(options: VisualUpdateOptions, host: IVisualHost): ChartViewModel { let dataViews = options.dataViews; let rows = dataViews[0].table.rows; let chartDataPoints: ChartDataPoint[] = []; for (let i = 0, len = rows.length; i < len; i++) { var row = rows[i]; chartDataPoints.push({ verantwortlicher: row[0] + '', gesamtKosten: <number>row[1], anzahlKostenstellen: <number>row[2], color: null, selectionId: null }); }
return {
dataPoints: chartDataPoints
};
}
Thank you in advance!
This is expected behavior as Power BI aggregates the same values by using an algorithm such as Sum, Count, etc.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
3 | |
1 | |
1 | |
1 |
User | Count |
---|---|
26 | |
3 | |
2 | |
2 | |
2 |