AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
NAV
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 08.12.2017, 03:13   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
stoneridgesoftware: Introduction to Data Analysis Expressions in Power BI
Источник: https://stoneridgesoftware.com/intro...s-in-power-bi/
==============

In this blog post, I would like to introduce something called Data Analysis Expressions, or DAX. DAX is a collection of functions, operators, and constants that allow you to create formulas and calculations that return values from objects that exist in your Power BI model. With DAX you can create columns, measures, and even your own tables. We’re going to keep it simple in this post and create a simple column and a measure. If you are familiar with creating expressions in Excel or in another BI tool, then DAX syntax will be easier to read but it doesn’t require any particular skill set.

Syntax


Sales Profit = ‘Sales'[SalesAmount] – ‘Sales'[Total Unit Cost] This is a simple formula in DAX. It calculates the Sales Profit.

The syntax contains the following elements:

a) Just like in Excel, the equals (=) operator begins a DAX formula.
b) ‘Sales’[SalesAmount] is our column that contains revenue, which comes from the model in Power BI. Column references are surrounded by square brackets [].
c) In this example, we are subtracting two measures so we’ll use the subtraction (-) operator.
d) ‘Sales'[Total Unit Cost] is our column that contains cost, which also comes from the Power BI model.

A slightly more advanced formula is presented below:
Units Sold = sum(‘Sales'[Quantity])

a) Here the measure name is called Units sold.
b) The function SUM adds up all the Quantity numbers in the ‘Sales’[Quantity] column.
This formula adds all the values of Sales Quantity.

Creating a Formula in Power BI

Here are the steps on how to create a formula in Power BI. We’re going to create a simple column calculation called “Customer Name.” Notice that in there is no Customer Name in my Customers table.



  1. Right-click on “Customers” and select “New column.” An area will appear below the tabs where you can enter a formula.
  2. Enter the following formula: Customer Name = ‘Customers'[LastName] & “, ” & ‘Customers'[FirstName]. To concatenate fields you can use the CONCATENATE function in DAX but that only accepts two arguments. Instead, we’re going to use the & operator.


Notice that the Customer Name column is now added to the Customers table. When you click on Customer Name you’ll also notice that there is now a formula in the formula bar, which is the formula we created for this column.

To create a measure please follow these steps:

1. Right-click on your fact table and select “New Measure.”



2. We don’t have a column that calculates Sales Amount in the model so we’ll create one now by using the formula Sales Amount = ‘Sales'[UnitCost] * ‘Sales'[Quantity] and entering it in the toolbar.





In this blog post, we were introduced to DAX and created two simple column and measure calculations. This is one of many blogs you’ll see on DAX here since you’ll be using it every time you’re in Power BI creating calculations. In my next blog post, we’re going to cover an advanced topic in DAX called Time Intelligence Functions.



Источник: https://stoneridgesoftware.com/intro...s-in-power-bi/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
stoneridgesoftware: How to Pull Data from Microsoft Dynamics 365 into Power BI Reports Blog bot DAX Blogs 0 19.07.2017 20:13
stoneridgesoftware: How to Integrate Power BI with Dynamics 365 for Financials Blog bot DAX Blogs 0 01.04.2017 02:17
stoneridgesoftware: Configuring Power BI Integration for Dynamics 365 Workspaces Blog bot DAX Blogs 1 07.03.2017 10:04
stoneridgesoftware: Email Alerts on Power BI Dashboards with Microsoft Flow – Better Together Blog bot DAX Blogs 0 19.01.2017 20:11
emeadaxsupport: SEPA affected objects Blog bot DAX Blogs 0 29.11.2013 13:11
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 11:20.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.