-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PowerBI #28
Comments
Saving Quick InsightsYou can pin an insight to a dashboard using the Working with reportsReports can have multiple tabs, with charts that can be filtered by a slicer. With tables that can be ordered by a specific column. You can drill down into subsets of data within a chart. You can include maps that represents positional data and your charts and tables can be filtered when selecting a data point on the map. Views within a report can be pinned to the dashboard. We can also pin live pages. This will display the default view of the report, ensure you save your edits for them to appear on the live page. DashboardA dashboard consists of multiple tiles, these can be reports, web content, images an SSRS report a text box or video. You can also query using natural language on a text item on a dashboard. Reports are restricted to show items from a single data model. While dashboards can include items from multiple reports. |
Getting data into Power BI
Database importYou can always import data from databases, this will copy your data into Power BI Direct QueryWith direct query you can access data directly from the database, but this is limited to specific types of databases, Sql server, Oracle, Teradata, SAP HANA. In order to do this you will need to have Enterprise Gateway installed. All model tables must come from the same database, so you can not mix and match data from various databases when using direct query mode. You can not use calculated columns or tables in the model when using direct query mode. Cannot change datatypes. This is still a good solution when datasets are large or you want real-time data access. Connect LiveThis is unqiue to analysis services, you can connect to data directly when working with tabular services without making any changes to the model. But you cannot combine tabular data with other sources. This also requires an enterprise gateway to be installed. You can explore multidimensional data in the Power BI desktop application, but these cannot be publish. Access and Excel Connection ErrorsPower BI uses the provider for the redistributable Microsoft Access database, which will need to be install and the link can be found here Loading data into ExcelData can be loaded from the |
Loading data in Power BI desktopSelect |
Web and Other SourcesThese can be files from a url, share point list, Hadoop file, active directory, OData feed or ODBC for databases that don't have their own connector, or from Microsoft Exchange server or even R scripts. Web UrlSelect get data from web and paste in the url Azure dataSuch as SqlDb or SqlDw and this can be used with direct query or import from the data sources. There is support for Blob storage, table storage, document Db, data lake, azure marketplace, HDInsights and Spark. As well as Saas, these include SharePoint Online, Dynamics CRM, Google Analytics, Facebook, Salesforce objects and reports and exchange online. |
Manual entryIn Power BI desktop click the enter data button, manually type then click |
Power BI guideshttps://docs.microsoft.com/en-us/power-bi/ Shaping dataThe steps you specify (for example, rename a table, transform a data type, or delete columns) are recorded by Power Query Editor. Those steps are then carried out each time the query connects to the data source, so that the data is always shaped the way you specify. |
Power BI and HarvestHarvest API documentation Why invest in a data warehouseA data warehouse is a database optimized for non-technical users. It has a focus on having less joins and should never be a production database. Having a central data warehouse is better than having multiple records Using a data warehouse allows us to reduce having multiple sources of truth and copy-paste errors. It is easy to develop QA suites that check and make sure the data stays accurate. Data warehouses are optimized for analytical and metric task focused performance. They partition analytical and operational tasks, which limits the risk of locking out other users as updates occur. Data warehouse for Power BI / Harvest syncingUsing Azure SQL Data Warehouse with Harvest Currently it appears you will need to make a script that take from the Harvest API and uses an ETL work flow. This data warehouse can then easily be connected to Power BI. To update the data audit information should be stored within the data warehouse to allow the script to update from the last run date. StichExisting solutions allow you to connect Harvest API to a data warehouse which can then be make available to Power BI. Although this has a large cost to it. But the point here is this is someone's marketed solution to connecting Web APIs to Power BI. |
Azure Application Insights and Power BIIt is possible to connect the Azure application Insights web API to Power BI, this is discussed here. |
Microsoft LearnCompleted the three tutorials on Power BI on Microsoft Learn. Create and share your first Power BI report Create and use analytics reports with Power BI |
Data directly from web APITutorial: Analyze web page data using Power BI Desktop |
PowerBI requirements Mindmeister
|
TODO
|
Json nested dataWhen imported complex json data Solutions are here, here and here We need to expand lists and records. This can be done through the UI Json data directly from API end pointTo load the data from Harvest we need to specify the curl "https://api.harvestapp.com/v2/time_entries" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Harvest-Account-Id: $ACCOUNT_ID" \
-H "User-Agent: MyApp (yourname@example.com)" To achieve this in Microsoft Power Query M we use the following
|
DAX Power BIData Analysis Expressions (DAX) is a library of functions and operators that can be combined to build formulas and expressions in Power BI Desktop, Azure Analysis Services, SQL Server Analysis Services, and Power Pivot in Excel. |
Figuring out how to grammatically create columns for each days in yearAdding all the days in the year as columns in Power BI manually is madness. It is better to automate this or have a rolling date range. Especially as we add more data year on year. We do not want to generate a massive report with an endless list of columns. We would prefer to have a parameter to specify the year you wish to fetch the data for. Then this will use This to figure out
Power BI do while during web crawlThe Youtube video shows how to use List.Generate with a lambda function along with Example of a
|
Power BI and Power Query Parameters and FunctionsThis Youtube video shows how to convert a query into a function. The applied steps transforming the data can then be applied to other files listed in a folder, where the file (binary) is the input parameter. This is done by adding a new custom column where you use the newly created function on each of the binary contents. |
Retrieve, Transform, and Combine Data Using Power QueryFollowing course on PluralSight Excel Business Intelligence Tools
Power BIIt uses Power Query as does Excel for querying data. Power Query
|
Working with Parameters and Functions in Power Query / Excel and Power BI
Parameters are a special type of query that return a single value. Normal queries will make a fetch for data then return a data table. Uses of parameters
Query parameters can be a list of a query. For list you manually specify the values. If you want to have a query that automatically gives you the possible values in a list. Then you will need to get a column containing the possible values and convert the table into a list. When changing the parameters value that is used within a query it will cause the data to be reloaded. This is not like a normal filter or slice which just modifies the already loaded data. Creating parameters within a query.When loading the data during the source step you can specify the file path to load or you can optionally create a new query from the drop down menu Creating a parameter template fileIn a template file you will first be prompted to set the parameters. It might be a good idea to have a template of the KPI saved where the user will specify the year when creating a report from that template. However this will of course mean the data will not run year on year. Generating functions
Create a new query from web source, paste in the url to some XML data. This url can be changed to be a parameter of type text. But now the parameter can be converted into a function right click and select All queries that make use of a function will use the current version of that function. Hence if you need to make a small change to many reports it is best to have that part extracted as a function, as you will then only need to make one change. This will then be reflected in all queries that use your function. Publishing with parametersIt is not possible to allow the end user to change the parameters once the report has been published onto Power BI online. One alternative when creating a Limitations with published parameters
|
Add a Filter to a report in Editing viewThere are four types of filters;
They will persist when navigating away from a report, allowing you to pick up from where you left of. To change the selected filters in a report go into You can filter with fields that are not included in the visual. From the field pane select the field you want to add as a new visual-level filter and drag it into the In addition to adding filters to specific visuals you can also filter on the |
Deep Dive into the M LanguageEven deeper talk on the key topics Custom connectorsThese are like a set of saved queries to allow you to pre-treat data before providing it to Power Query / Power BI. To create custom connectors you use Visual studio with the Power Query SDK. You build and deploy your custom connector which can then be accessed in Power BI.
When creating a custom connector you can add additional meta data to create a branded connector. Design Tenets for "M"Target audience is information Workers and data analysts
For that audience, the language should be:
Language FlowEvaluation flows from one step to the next. Where the next step references the output from the previous step. You are not limited to this flow and an output from one line can be used multiple times. If a line is created but not consumed in any of the future steps then it will not be evaluated at run time, M is a lazy evaluated language. If you have a line of M that is not consumed but is used for logging then it will be stripped out. This can be a source of error.
Type SystemAt the primitive level there are no int8, int16 byte e.t.c. A small set of built-in types
You can set types on a function parameter, this can be done using the as key word.
Ascribed TypesA value's ascribed type is the type to which a value is declared to conform to. When a value is ascribed a type, only a limited conformance check occurs. M does not perform conformance checking beyond nillable primitive type. M program authors that choose to ascribe values with type definitions more complex than nullable primitive-type must ensure that such values conform to these types. This essentially works as a format, from the M engine point of view a number is a number but if the user ascribes the type to be an Int8.Type then the Power BI desktop will store data differently based on the type. When the user tries to enter a value from within the UI that is outside of the ascribed type definition the user will get a warning. This is handy as it allows you to further restrict the range of values coming from the user. Commonly used ascribed types
Simple Values in M
Symbolic OperatorsYou can only concat the same types, you will need to manually convert a Conditional access with ? ensures you get back null if an error occurs, i.e. if the record does not exist.
Complex Values - List, records, tables, and otherListsare defined with the curly brackets, this is the opposite of json. RecordsWhile records, which can be thought of as objects are again the opposite of json and are defined with square brackets. Records can contain other types within them. Records can be named
To then access the value of a record you use the Tablesare defined with Example of a table with implicit types
Example with explicit types, which returns the first row.
Records can be nested within values of other records. FunctionsFunctions are a type and a value, more information at Expressions, values and let expressions. So you can parse functions as a parameter to another function. TypesYou can declare new types Recall List Types Record Types Table Types Function Types BinaryThe binary library allows you to parse binary files, reading headers from png, or parsing zip files e.t.c. Deep Dive into the M Language slides.pptx Types in the Power Query M formula language.pdf Power Query M Formula Language Specification (February 2019).pdf Further reading |
Conditional logic and errorsIf expressionsFor example ``if ` 1 < 2 then "Happy" else "Sad". This is simple and support multiple operators as shown in
Let expressionsThis is the general structure of how you start and end M statements. This example defines
Error expressions and more on errorsIf you want to throw an exception you can use the follow
Errors can follow a record with
Try expressionsM will attempt to evaluate these expressions and if it fails it will return the alternative result.
|
FoldingPower query will fold M queries into SQL where needed, or any other language that the data source reflects. This supports column filters, row filters, joins, group by, pivot and unpivot. This also applies to numeric calculations and aggregations. When the data source is just a simple text file then power query will process the file locally in memory. Privacy settingsare considered when folding, if a query can/will be folded then you will receive a prompt to indicate the privacy of the data. I.e. if you join to tables you will be required to enter if the data is public or private. This is to protect you from exposing private data when folding with public accessible data. Otherwise Power Query will send your private data with the public data to the public data web server. With the right privacy settings in place power query will do the operations locally instead. |
ListsTo create a new list for values 1 through to 10 the
This then produces a list of values from 1 to 10. You can also create a list of records and they do not need to be homogeneous. The last item in the below example is a different record object type to the first two elements.
List can then be converted to a table using Table.FromList() this can also be done by using Table.FromRecords() which takes in a list of records. In this case the function does expect the Records to be homogeneous. Unary FunctionsThese functions take in a single parameter, here the
A shorthand for the above is to use the
Since we are not parsing the
All 3 of the above samples are equivalent. The third expression is closer the the DAX syntax |
Create columns for all days in year 2019
Merge Names table with 365 days in the year tableThis is a work in progress, this does not merge as expected and to also assign values for each name on each of the days is difficult at this stage.
Attempt 2, was doing too much in the M side of things
|
Getting Started With Dax Formulas in Power BIDax is an expression language for distilling your data into bite-sized insights. It looks similar to Excel but it is much more powerful. DAX is column focused rather than focusing on each cell as is the case with Excel. DAX is used in Power BI, Power Pivot, SSAS tabular mode and and Azure Analysis Services. What is DAX good at?
When creating a report
The Power of DAXTo get the total sales
What is DAX Not Good at?
The problem with learning DaxAt first DAX appears to be similar to a combination of Excel and SQL formulas which makes it feel simple. Despite DAX looking similar to Excel, even sharing the same function names, the logic is very different since the unit of measure is the column not rows / cells. When you start working with calculated columns, measures, filtering and Evaluation contexts there are new concepts you need to learn. Calculated columns and measures look very similar but have different use cases. After this it gets easier again with time intelligence and nesting evaluation contexts. DAX involves manipulating filters, it allows you to take current date ranges and shift them by a year. This provides a simple way of getting year on year analysis with little work. Data Governance, managing your data from an organisational level.Data Governance is a set of processes that ensures that important data assets are formally managed throughout the enterprise. Data Governance
Self service business intelligence can be summarized with a litmus test, if an accountant needs to speak to IT to get the data needed for a report then the organisation is not self servicing.
What is the cloud?-The cloud, originally was a place holder "IDK" on a networking diagram
Thinking in Columns, Not Rows
Things to optimize for.
Columnar databases are highly optimized for analytical reporting. While row wise databases is like a Swiss army knife it's pretty good at many things.
Adding Business Logic with Calculated Columns and MeasuresGross sales is Adding meaning
Calculated columns are computed at the time of refresh, so when you reload your data all these calculated columns will be computed. Row context restricts your expression to only seeing values for each specific row. Example of Calculating Gross Sales
Adding Column from another table as one to manyIn order to add a new column from another table we need to define a relationship. This is due to the expression being restricted to the row context. For this we use Here this is a one to many relationship. Adding a Column for many to one relationshipsIf we wanted to create a relationship in the opposite direction We have regular aggregate functions and iterators, aggregate functions take in a single column and evaluates based on that one column. An iterator takes in two parameters, a table and an expression to evaluate. To change the format of a column use If you do not create a relationship, or can not due to a circular reference. You can still add a column to take data from another table with the MeasuresCalculated columns are limited, measure are harder to grasp but allow us to manipulate filters applied by the user. This allows us to look at all of the data one column at a time rather than a single row. A measure is an expression that summarizes all of the data and is evaluated at run time, so this uses more CPU but less RAM. Measures are limited by a filter context but we can manipulate it. An example of a measure is Calculate columns extend the table horizontally while measures extend the table vertically. They are loosely associated with the table and can see all data within the filter context Creating a measure in DAXMeasures allow you to manipulate filters such as data information as well as overriding user filters the user has applied. They can also be used to form more complex aggregates when From the Creating a measure Limitations of measuresIf we wanted to create a slicer to filter by colour this works fine, if we wanted to use our measure it won't work. You can not select a measure as a filter. You must use a calculated columns, this makes sense as the measure of Filtering data using CalculateThis allows us to get data with filters such as These filters can be modified in DAX using the The
You can remove filters using |
Notes from Getting Started with Power BI
Power Query Documentation
Power Query M Reference
Introduction
Power BI is a cloud based service for combining a variety of data sources to build a data model to answer analytical questions. You can then build dashboards to see information at a glance, or make interactive reports. Power BI also supports natural language queries and Quick Insights to quickly start exploring your data. Power BI supports iOS and Android.
Using Datasets and Data Models
You can create a Data Model which can be stored in a
*.PBIX
or*XLSX
file. The other option is to take data which can be*.XLSX
,*.XLSM
or a*.CSV
file. Uploading the data into Power BI results in a Dataset.A report can only include data from a single Dataset , if you need to combine data then you should create a Data Model to store the various bits of data. If you upload an
*.XSLX
or*.CSV
into Power BI you cannot later make changes to the structure.Uploading Datasets
Import or Connect to data. You can select a
Local File
. When you upload a Datasets or Data Model into Power BI you can use the Quick Insights feature to begin exploring data. This produces up-to 8 insights.Use the navigation menu select
Datasets
>...
>Quick Insights
The text was updated successfully, but these errors were encountered: