User Profile
rbartk01
Frequent Visitor
Joined 7 years ago
User Widgets
Contributions
Custom Visual - Object enumeration - Series with objects binding issue
Hi, I'm currently working on Power BI Custom Visual and struggle with Visual objects and properties data binding for Series (withSeries) data. Basically, goal is to bind Data Color Selector for dynamic series/groups in my stacked-barchart like visual. I looked in multiple public git repos of Microsoft's visual, where such binding is done, but none of the scenario is fitting mine simple approach. The issue I am facing is that after enumerating object instances with my Serie Selection IDs, nothing is pushed to DataView (DataViewObjects are not added). I tried my approach with Categorical and Measure selections, it worked well - objects property was binded to DataView (withCategory and withMeasure). Maybe you will be able to help me, or advice how to proceed. Thanks a lot! Below codes: Current state I am working on: # Preparation of Series data points with Selection IDs let categorical: DataViewCategorical = dataView.categorical; let categories: DataViewCategoryColumn = categorical.categories[0]; let series: DataViewValueColumns = categorical.values; let values: DataViewValueColumnGroup[] = categorical.values.grouped(); this.waterfallSeries = []; for (let i = 0; i < values.length; i++) { const element = values[i]; let serieSelectionId = this.host.createSelectionIdBuilder() .withSeries(series, element) .createSelectionId(); this.waterfallSeries.push({ serie: <string>element.name, serieSelectionId: serieSelectionId, color: '' }) } # Objects enumeration public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[] | VisualObjectInstanceEnumerationObject { let objectName = options.objectName; let objectEnumeration: VisualObjectInstance[] = []; switch (objectName) { case 'colorSelector': for (let serie of this.waterfallSeries) { objectEnumeration.push({ objectName: objectName, displayName: serie.serie, properties: { fill: { solid: { color: serie.color } } }, selector: serie.serieSelectionId.getSelector() }); } break; } return objectEnumeration; } # Capabilities (I have 2 groupings and 1 measure -> groupped category) { "dataRoles": [ { "displayName": "Category", "name": "category", "kind": "Grouping" }, { "displayName": "Legend", "name": "legend", "kind": "Grouping" }, { "displayName": "Y-Axis", "name": "measure", "kind": "Measure" } ], "objects": { "dataPoint": { "displayName": "Data colors", "properties": { "defaultColor": { "displayName": "Default color", "type": { "fill": { "solid": { "color": true } } } }, "showAllDataPoints": { "displayName": "Show all", "type": { "bool": true } }, "fill": { "displayName": "Fill", "type": { "fill": { "solid": { "color": true } } } }, "fillRule": { "displayName": "Color saturation", "type": { "fill": {} } }, "fontSize": { "displayName": "Text Size", "type": { "formatting": { "fontSize": true } } } } }, "colorSelector": { "displayName": "Data Colors", "properties": { "fill": { "displayName": "Color", "type": { "fill": { "solid": { "color": true } } } } } } }, "dataViewMappings": [ { "categorical": { "categories": { "for": { "in": "category" }, "dataReductionAlgorithm": { "top": {} } }, "values": { "group": { "by": "legend", "select": [ { "bind": { "to": "measure" } } ] } } } } ], "sorting": { "default": { } } } # Output Visual pane is being fulfilled by the series. After selecting random color, nothing is happening to the DataView - unfortunately, objects are not binded to DataView's metadata As mentioned in intro paragraph, when I used Categories selectors in enumerateObjectInstances after enumrating objects in my DataView metadata (for categories) objects property is being added (array of object instances for each category) Below code how I generated Category selection IDs: let categorySelectionId = this.host.createSelectionIdBuilder() .withCategory(categories, i) .createSelectionId(); Any ideas what I'm doing wrong or how should I proceed? Thanks in advance! Best Regards405Views0likes0CommentsDynamic calculated table/column or measures as axis
Hi, I know there are some old threads about my subject, but there were no clear solution for that and my question is slightly different. This is why I wanted to start a new one. Maybe actual state of knowledge could help with overcoming the limitations. I have a task to create a report where end-user has 1 page to set up parameters of some classification measures. It needs to be dynamic, because classification depends on time period, range of products, calculation method, some additional parameters. Afterwards, we would like to use this classification in the next pages to visualize data. In the other words, I would like to have additional calculation layer between the visuals and the data model. Is there any chance I could achieve that in Power BI? Dynamically recalculated tables, or columns would work perfectly. Maybe something like freezing the results and using them afterwards. Do you have any ideas? Maybe usage of some analytical services would help? Unfortunately, I do not have much experience in that so I seek also for some inspiration. Do you think this is achievable in Power BI? Best, RafalRe: Cumulative sum with Date Hierarchy
Dear AnthonyTilley, Sorry for bothering, but do you have any idea how I could apply this measure of cumulative sum split by some other column of categories? Right now it set's cumulative value for particular date for all categories, what multiplies cumulative sum by number of categories in stacked barchart. See how it looks on pic: Thanks in advance!11KViews0likes0CommentsRe: Cumulative sum with Date Hierarchy
Dear AnthonyTilley , This worked! Thank you so much! I felt that this is the case of calculating values of particular day after drilling down into day level of Date Hierarchy, but didn't know how to overcome this... and this was that easy to fix. Once again thanks. Best Regards, Rafal11KViews0likes0CommentsCumulative sum with Date Hierarchy
Hi, I try to create a measure for cumulative sum using below DAX formula: Cumulative sum = CALCULATE( SUM('Sanitized CopyData'[Net Benefits]); FILTER( ALLSELECTED('Sanitized CopyData'[Date]); 'Sanitized CopyData'[Date] <= MAX('Sanitized CopyData'[Date]) ) ) What is interesting, this measure works perfectly but only if I am using Date column as Date. Whenever I switch to Date hierarchy - measure shows exactly the same values for both: sum of my [Net Benefits] column and measure Cumulative sum. I attach screenshots of both situations. Do you have any idea how I could create measure of cumulative sum working with date hierarchies? Thanks!Solved11KViews0likes3Comments
Data Privacy
Microsoft Fabric Community and Privacy
To learn more about how we manage your data, please review the Microsoft Fabric Community Data Privacy guide.