Developing PowerBI Visuals - powerbi

I find it difficult to wrap my head around developing a PowerBI visual from scratch. I was reading wiki, guide, inspecting examples, but still feel like there's a huge gap in understanding how it works internally - it did not 'click'. (I understand basics of how D3 works so not too worried about that part)
Question:
I hope I'm not asking too much, but could someone, using this barchart as an example, post a sequence of which methods in the visual source are called (and how the data is converted and passed) when:
The visual is added to the dashboard in PowerBI,
A category and a measure are assigned to the visual,
Data filter in PowerBI changes,
An element on our custom visual is selected.
Your option which you think may be relevant
I used this specific visual as an example because it was mentioned as meeting minimum requirements for contributing a new custom visual, which sounds like a good starting point, source:
New Visual Development
Please follow our minimum requirements for implementing a new visual. See the wiki here.
(the link references the barchart tutorial)
However, if you have a better example visual - please use that instead.
This is all I got:
Many thanks in advance.

I also have some extra and more generic additions:
Power BI uses the capabilities.json structure to determine a) what should be data pane (dataRoles) and how Power BI bind that data to your visual (dataViewMappings) and b) what can be shown in the formatting pane (e.g. placeholders).
the enumerateObjectInstances() is an optional method that is used by Power BI to initialize the formatting pane. The structure returned by this method should be equal to the structure in the capabilities.json file.
the update() method (required) is called when something is changing regarding your visual. Besides databinding changes, also a resize of the visual or a format option triggers the method.
the visualTransform() method is indeed an internal method and not directly called by Power BI. In case of the BarChart it is called by the update() method so the arrow is correct. Most visuals have some kind of method and it is used to convert the Power BI DataView structure to the internal structure (and sometimes to some extra calculations).
Both the constructor and the update() method have parameters (options) which provides callback mechanisms to Power BI, like the ISelectionManager (via options.host.createSelectionManager()), which alters the interaction of the visual with the rest of the Power BI visuals.
The structure of how custom visuals are interacting with Power BI hasn't changed that much since the beginning. Only with the new API the interaction and possibilities has changed: is used to be an open world, but now it is limited.
Hope this helps you in gaining a better overview of a Power BI custom visual.
-JP

A few comments on your graphic. You are obviously using the view model (good):
After any data change, filter change, or object change (format in your pic), visualTransform() is called. The data comes in odd formats so will need repackaging (for anything other than simple). That gets done here and a data object that the developer defines gets returned. I build this data object as an array because d3 loves arrays.
update() is then called (I think your arrow in the pic here is the wrong way around). This is slightly tricky because d3 interaction now comes into play. If you have used d3().enter (and you probably have) then that executes only once so on a subsequent PBI update() only d3() non-enter instructions are followed. If you put everything in d3().enter then any subsequent data update won't appear to work.
Alternatively you can d3().remove() and rebuild the svg on each PBI update(). Whether this is practical will depend on your data and the visual.
Thank you for having a crack at documenting the flow. MS documentation is very lame at the moment.

Related

How to prevent unwanted access to Fact table?

I am using RLS in SSAS and it works fine:
I filter the table Project... Therefore, if a certain group has access only to Project X. They only see that.
(I use visuals in POWER BI that use a mix of fact measures with the Project dimension).
No issues there, the RLS works fine.
My question is: if the Project dimension is not pulled/used; the access does not get enforced... (I have control over POWER BI, and I pull/use the Project dimensions in all my visuals... But any user can connect to the model (through excel for example) and see ALL the data in the fact. How can I avoid this?
(I am not too worried, since in the fact I have mostly keys data, but they can still see 'revenue' for example...)
But any user can connect to the model (through excel for example) and see ALL the data in the fact. How can I avoid this?
If there's a filter path from Project to Fact, and you have RLS rules on Project Fact will be filtered for all users in the RLS role, regardless of whether they query Project directly.

Power BI, I need a multi-layer map with Drilldown Choropleth... invalid json+not seeing fields to add data

Anyone have experience with Drilldown Choropleth recently? I have taken a step back to try ArcGIS, but want to have a multi-layer map built in Power BI with shading using this add-in. I am having issues with loading the json- one for States (USA), one for Metro Area (MSA, USA). Also, not seeing the fields to add data points. This info I researched on the app my info has a json file link that is going to a 404.
If anyone wants to provide tips to transfer over to a contained ArcGIS, I would accept that.
More on the app: https://appsource.microsoft.com/en-us/product/power-bi-visuals/wa104381044?tab=overview
I basically need one layer shading on drill down for geo with points, then add one layer for demographic stats, one layer for population stats. Help?
for topojsons that work:
https://github.com/deldersveld/topojson
I used the US Counties one, so that's all I can comment on working.

Is there a way to pass data source connection string as a parameter to power bi embedded?

I have a pbix file that takes an Azure Storage account as a parameter and reads data from there accordingly. The next step is to be able to embed this powerbi dashboard on a webpage and let the end user specify the storage account. I see a lot of questions and answers surrounding passing in filter query parameters--this is different, we're trying to read from a completely different data source and not filtering on a static data source.
Another way to ask this question is: is there a way to embed powerbi template files, if not, is there a feature request somewhere we can upvote?
The short answer is no.
There is a reason to use filters in this case instead of parameters. Parameters are something that is part of the report itself. Each users that looks at your reports will get the same parameter values as the others. If one of them changes some parameter, this will affect all other users. Filters on the other hand, is something local for your session. You can filter the report the way you like, and this will not affect other users experience in any way.
You can't embed templates, because template is simply a state of the report on the disk. When you open it, it's not a template anymore, but becomes a report.
You can either combine the data from all of your data sources in a single report, adding one more column to indicate from where this data comes from, and then filter on this new column. Or create/modify ETL process (for example dataflows can be used for this) to combine these data sources into a single one.

Inventory Management Calculated Field in SharePoint 2010 across 2 Lists

I need a formula to calculate how much inventory is left on had after a work order has been completed. The work order I am developing is a separate list in sharepoint and I have an inventory list as well.
In the inventory list I have a field called amountinventoried and itemname which the user would put the amount of the item we had on hand during the last manual inventory.
On the work order list I have a field called itemused and amountused I need to find a formula to use on a calculated field in the Inventory list that would go out and simply subtract the amountused from the amountinventoried but only if the itemused and itemname fields matched.
I have been working on this for quite a while and have hit a wall, I'm probably overlooking something extremely easy but I'm still new to sharepoint 2010.
Thanks!
You may be able to do this in a grouped view of the work order list (sort of like this), but I think the design of what you are doing is not suited to using SharePoint lists.
You may be much better off using an SQL database to host and calculate the data and connect it into SharePoint as External Lists using the Business Connectivity Services (brief explanation here).
This gives you the benefit of CRUD functionality in SharePoint, with the extra calculations and trickery available within SQL views and tables.

Tell SAS not to add newly generated tables on the Process Flow

I have a SAS code that creates a lot of intermediary tables for my calculations. Thing is, I don't really care about this tables after the job is done, I only care to the finals results.
But, everytime I run this code, SAS add all the generated tables do my process flow, turning it into a huge mess (I am talking here of 40+ intermediary tables).
Is there a way to tell SAS not to add some tables to the process flow? Or at least to tell it not to add any tables at all? I am using SAS Enterprise Guide 4.1
Thanks in advance
Under SAS 9.1.x and 9.2.x (for Windows), it's possible to suppress the display of datasets in SAS client environments by prefixing the dataset name with "_TO". So in your code and/or tasks, you could call all your intemediate datasets _TO<DataSetName>, and they won't clutter up your process flow. But they will still be there and can be referenced in code and tasks.
If you do this and you're using tasks, note that it might be tricky to work out how to use the output data from a task as the input for another, if you can't see the dataset to select it. If you have trouble with this, comment on this post and we can address that.
Note that this "_TO" prefix thing is an undocumented, "hidden" feature that is to be deprecated in 9.3 - see this blog for details.
If you set the option "Maximum Number of output data sets to add to the project" (under Results General) to zero, it will not add any datasets to the project, but they'll still be available to view from the Server -> Library view (they'll be added to the flow at the point you request them).
I know this question is a year and a half old now, but if you are working with intermediate tables that can be deleted after you get the final results, SAS EG has a built in macro you can use for deleting these tables:
%_eg_conditional_dropds([table1], [table2], ... ,[table-n]);