Position Enjoying Dimensions in Energy BI

Date:


On this submit I need to clarify the best way to deal with function taking part in dimensions in Energy BI. I wrote an article awhile in the past concerning function taking part in dimensions in SSAS Tabular which is legitimate for Energy BI Desktop.

To recap, within the function taking part in dimensions in SSAS Tabular article I defined three completely different options:

  1. Importing function taking part in dimensions a number of occasions into the mannequin
  2. Creating database views within the supply aspect (in case your supply is a from of RDBMS like SQL Server, Oracle and so on…) then import the info into the mannequin
  3. Preserve the inactive relationships within the mannequin and create a number of measures to handle completely different roles utilizing USERELATIONSHIP capabilities in DAX

On this submit I present you other ways for the primary two options to deal with function taking part in dimensions with out importing information a number of occasions into the Energy BI mannequin. You additionally don’t must create database views in your supply database. I present you the best way to handle this in each DirectQuery and Import modes when connecting Energy BI Desktop to a SQL Server database. I clarify the third choice in one other submit.

I used AdventureWorksDW, however, you should use some other variations of AdventureWorksDW database or you’ll be able to mimic the method to your personal mannequin.

Observe: If you’re designing a star schema in your information warehouse you’ll be able to simply create a Date dimension as defined right here.

The thought is to handle function taking part in dimensions in Energy BI Desktop itself within the simplest way potential.

  • Open Energy BI Desktop
  • Get information
  • Choose “SQL Server”
  • Enter the server and database names then click on OK

Power BI SQL Server Connection

  • Choose DimDate and FactInternetSales from the listing then click on “Load”
  • “Import” mode is chosen by default. Click on OK

Power BI Connection Settings

Power BI Desktop

  • Rename DimDate and FactInternetSales to make them extra consumer pleasant

Power BI Desktop Task Pane

  • Create a brand new calculated desk by clicking “New Desk” button from “modelling” tab from the ribbon

Power BI Desktop Calculated Table

  • We’re creating a duplicate of “Date” desk utilizing DAX expression. To take action simply kind the next DAX expression:

              Order Date = All(‘Date’)

  • As you would possibly observed the icon for “Order Date” desk (Power BI Desktop Calculated Table Icon) is a bit completely different than the traditional desk icon (Power BI Desktop Table Icon) as the brand new desk is a calculated desk
  • Create two extra calculated tables for “Ship Date” and “Due Date” utilizing the identical expression

Power BI Desktop Role Playing Dimension

  • Click on “Relationships” to create new relations between the calculated tables we created and “Web Gross sales” desk

Power BI Desktop Relationships View

We’re carried out now. We’ve all roles in our mannequin.

  • Put a column chart on the report and put “Fiscal 12 months” column from “Order Date” to the chart axis then put “Gross sales Quantity” from “Web Gross sales” on values. (You possibly can create an specific measure for “Gross sales Quantity” however for simplicity I hold utilizing the implicit one.)

Power BI Desktop ColumnChart

  • Repeat this for the opposite two date dimensions

Power BI Desktop ColumnCharts

You possibly can cover the “Date” dimension in information mannequin, or you’ll be able to unload it within the Energy Question layer to cut back the complexity of the mannequin.

Though the DirectQuery is an superior characteristic in Energy BI it has some few limitations. Certainly one of them is that we CANNOT create calculated tables. So we’ve to go for an alternate resolution.

Observe: You possibly can be taught extra about DirectQuery right here. However, some info is out-dated as within the new launch of Energy BI among the limitations like creating calculated column and calculated measure are resolved. So the limitation on making a calculated desk in DirctQuery mannequin would possibly guess resolved within the subsequent releases of Energy BI. (Energy BI Desktop present model: Model: 2.33.4337.281 64-bit (March 2016)).

Power BI Desktop Create Calculated Table Disable in DierectQuery

Let’s get the job carried out in DirectQuery.

The primary steps of getting information are the identical simply it is advisable choose “DirecyQuery” in “Connection Settings” web page as an alternative of “Import”.

Power BI Desktop Connection Settings DirectQuery

After loading the mannequin comply with the steps under:

  • Click on “Edit Queries” from “Residence” tab from the ribbon

Power BI Desktop Edit Queries

  • Rename DimDate and FactInternetSales to consumer pleasant names

Power BI Desktop Query Editor

  • Proper click on on “Date” and choose “Reference”

Power BI Desktop Reference Table

  • If you wish to see the Energy Question “M” scripts behind the seen for a reference desk click on on “Superior Editor” from “View” tab

Power BI Desktop Advanced Editor

  • Rename the reference desk to “Order Date”
  • Repeat this and create Due Date and Ship Date reference tables
  • Click on “Shut & Apply”

Power BI Desktop Query Editor 2

Power BI Desktop Query Changes

  • Swap to “Relationships” view

Power BI Desktop Relationships 2

  • Preserve simply the right relationships and take away undesirable ones between “Order Date”, “Due Date”, “Ship Date” and “Web Gross sales”

Power BI Desktop Relationships 3

Alright, we’ve all of the function taking part in dimensions in our mannequin. You possibly can cover the “Date” dimension in information mannequin, or you’ll be able to unload it within the Energy Question layer to cut back the complexity of the mannequin.

Professionals:

1- In case your mannequin is a small mannequin then you’ll be able to shortly import new function taking part in dimensions into the mannequin both in Import Mode or DirectQuery Mode, creating relationships and also you’re able to go

2- It might be simpler for the top consumer to have completely different Date choices. You’ll have separate slicers within the Energy BI. Nonetheless, you’ll have to handle filter interactivities and cross filtering which implies extra improvement time.

3- You’ll have only one measure to be sliced and diced by completely different roles individually

Cons:

1- In case your mannequin just isn’t small and you’ve got rather more function taking part in dimensions to handle then you definitely’ll find yourself importing the size a number of occasions which isn’t environment friendly

2- Having plenty of completely different function taking part in dimensions as separate tables everywhere in the mannequin shall be actually complicated for the top consumer and you’ll actually need to spend extra time/cash to coach the top customers. It’s also fairly arduous to take care of such a giant mannequin with plenty of function taking part in dimensions

3- You devour extra storage and reminiscence which is once more not that environment friendly

On the finish of the day it actually is dependent upon your buyer wants. Learn extra in regards to the different technique to handle Position Enjoying Dimensions right here.

All carried out!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Share post:

Subscribe

spot_imgspot_img

Popular

More like this
Related

Shrinkflation’s Function in Growing Emissions: Elements to Know

For environmentalists on the market, shrinkflation and emissions...

Why Excessive-Strain Gross sales Ways Are Killing B2B Offers (And What to Do As an alternative)

In case your gross sales technique nonetheless depends...

German search engine Ecosia unveils new local weather affect expertise for customers, shifting away from tree planting

Berlin-based Ecosia, the inexperienced search engine which invests...

Buyers: The best way to Maximize Returns and Reduce Danger in Right now’s Market

In today’s unpredictable monetary panorama, putting the appropriate...