Forum Discussion
in selector json what is the 't' attribute
- 7 years ago
Hi rdegr,
I had a similar request andwas able to solve it in the following was:
1. I create an array of custom identities, in this case it uses the category as text, but that can be changed to SQExprBuilder.number if needed.
let categoryIdentities = categories.map((category) => { let sqlExpr = powerbi["data"].SQExprBuilder.equal(dataView.metadata.columns[0].expr, powerbi["data"].SQExprBuilder.text(category)); return powerbi["data"].createDataViewScopeIdentity(sqlExpr); });
# ref: https://github.com/liprec/powerbi-boxWhiskerChart/blob/89179879a7209b030245fd05c317eee2034db394/src/boxWhiskerChart.ts#L2602. When I loop thru the individual catagories (=i variable)I use the following code to create the correct SelectionId identifier:
let selectionId = new SelectionId({ data: [ categoryIdentities[i] ] }, false); # ref: https://github.com/liprec/powerbi-boxWhiskerChart/blob/89179879a7209b030245fd05c317eee2034db394/src/boxWhiskerChart.ts#L282I added links to my solution for more reference and hope this can also work for your visual.
-JP
I'm not trying to add extra columns, but to work around them being added when I don't want. Your SQLExprBuilder code was helpful to me, it replaced about 20 lines where I was building a selector object from scratch. Thanks!
I've solved my problem and will select the most helpful of these replies as (part of) the solution. For the issue of being limited to 30K values I preloaded values for known columns.
module DistinctValues {
export var qtEmergencyRecords:any = {};
qtEmergencyRecords["Year"] = [ 2016, 2017 ];
export var qtFacility:any = {};
qtFacility["Facility County"] = [
"Alachua",
"Baker",
"Bay",
"Bradford",
...then in processing a category "cat"
let arr = cat.values;
if (DistinctValues[expr.source.entity])
{
let dvs = DistinctValues[expr.source.entity];
if (dvs[expr.ref] && dvs[expr.ref].length)
{
arr = dvs[expr.ref];
}
}
arr.forEach((val:any, valIndex:number) => {