When I embarked on my Power BI journey I was almost immediately slapped with an onslaught of foreign and perplexing terms that all seemed to do similar, but somehow different, things.
當我開始Power BI之旅時,我幾乎立刻受到了外國和困惑術語的沖擊,這些術語似乎都在做著相似但有所不同的事情。
There is a language called M but there is also a language called DAX? What is the difference between a calculated column and a measure? When should I be using Power Query?
T 這里是一種叫做M的語言,但也有一種叫做DAX的語言? 計算列和度量之間有什么區別? 什么時候應該使用Power Query?

I got stuck really early in my journey trying (and failing) to understand some key concepts that made Power BI seem much more difficult and confusing than it is. I almost abandoned my BI ambitions to crawl back to my familiar pal, Excel. Better the devil you know, right? WRONG!
我在嘗試(失敗)嘗試的過程中很早就陷入了困境,并且未能理解一些使Power BI看起來比實際困難和混亂的關鍵概念。 我幾乎放棄了我的BI野心,回到了我熟悉的朋友Excel。 更好的惡魔,對嗎? 錯誤!
I am so, so, SO happy that I kept banging my head against the wall to get over those initial hurdles. Today, I use Power BI almost daily, and I use it cheerfully, gleefully even, and I rarely use Excel. But getting here was hard, really hard. And it was harder than it should have been because, for a long time, I did not have a clear, conceptual understanding of some key Power BI concepts.
我是如此,如此,如此高興,我一直將頭撞在墻上以克服那些最初的障礙。 今天,我幾乎每天都在使用Power BI,并且愉快,愉快地使用它,而我很少使用Excel。 但是到這里很難,真的很難。 而且這比原本應該的困難,因為很長一段時間以來,我對某些關鍵的Power BI概念沒有清晰的概念性理解。
I am going to try to keep things as simple as possible to give you just a hint, a tinge, a taste to get you started.
我將嘗試使事情盡可能簡單,以便給您一個提示 , 淡淡的色彩和使您入門的品味 。
More experienced Power BI users might cringe at the way I am (over) simplifying and reducing these concepts, but you know what? At this point, all of the nuance and minutia really doesn’t matter. You need a place to start. Trust me, the complexity will come.
經驗豐富的Power BI用戶可能會對我簡化和減少這些概念的方式感到畏縮,但是您知道嗎? 在這一點上,所有細微差別和細節都不重要。 您需要一個起點。 相信我,復雜性將會到來。
So, my intrepid warrior, my Padawan, my Power BI master-to-be, here is a very basic overview of:
因此,我的勇敢勇士,Padawan和Power BI未來的主人,這里是以下內容的非常基本的概述:
Power Query and M
功率查詢和M
DAX
達克斯
Calculated Column and Measures
計算列和度量
Power Query vs. DAX
電源查詢與DAX

功率查詢和M (Power Query and M)
What the heck is it? This is where it all begins. Power Query is where you pull your data into Power BI. M is the coding language used by Powery Query. You can use Power Query by pointing and clicking and the code in M will essentially be created for you. You can also write your own code in M directly.
這到底是什么? 這就是一切的開始。 Power Query是將數據拉入Power BI的地方。 M是Powery Query使用的編碼語言。 您可以通過指向和單擊來使用Power Query,M中的代碼實際上將為您創建。 您也可以直接在M中編寫自己的代碼。
When do I use it? To clean and format your data. You can do things like remove and add columns, filter out data, change column formatting, etc.
什么時候使用? 清理和格式化數據。 您可以執行刪除和添加列,過濾數據,更改列格式等操作。
Do I have to use M?: Short answer, no. You can do most things in Power Query by pointing and clicking without needing to use M at all. However, knowing M can be really helpful in making your process more flexible and easier to replicate in the future. For example, when using M you can copy and paste bits of code you want to reuse and you can annotate your steps.
我必須使用M嗎? :簡短回答,不。 您可以通過指向和單擊來執行Power Query中的大多數操作,而根本不需要使用M。 但是,了解M確實可以使您的過程更靈活,將來更容易復制。 例如,使用M時,您可以復制和粘貼要重用的代碼位,并可以注釋步驟。
Tip for learning: Do what you need to in Power Query by pointing and clicking and then open the Advanced Editor. The M code will be there for the manipulations you have just completed. This way, you can start to get familiar with the language and by making small tweaks before you try writing your own M code from scratch.
學習提示 :指向并單擊,然后打開“ 高級編輯器” ,即可執行Power Query中需要執行的操作 。 M代碼將在其中用于您剛剛完成的操作。 這樣,在嘗試從頭開始編寫自己的M代碼之前,您可以進行一些細微的調整,從而開始熟悉該語言。
達克斯 (DAX)
What the heck is it? DAX, short for Data Analysis eXpressions, can be used to create measures and calculated columns once your data has been pulled into Power BI with Power Query/M.
這到底是什么? DAX是Data Analysis eXpressions(數據分析表達式)的縮寫,一旦將數據通過Power Query / M導入到Power BI中,即可用于創建度量和計算列。
When do I use it?: Using DAX is essentially like using formulas in Excel — it allows you to make calculations based on your data. You can use DAX to create calculated columns or measures.
我什么時候使用它?:使用DAX本質上類似于在Excel中使用公式-它使您可以根據數據進行計算。 您可以使用DAX創建計算列或度量。
計算列和度量 (Calculated Columns and Measures)
What the heck is it? Calculated columns and measures are two ways to write expressions in DAX. A calculated column will create an additional column with a value for every row in your table. A measure is an aggregate expression based on multiple rows in a table or multiple tables.
這到底是什么? 計算列和度量是在DAX中編寫表達式的兩種方法。 計算列將創建一個附加列,該附加列為表中的每一行提供一個值。 度量是基于一個表或多個表中的多行的聚合表達式。
When should I do a measure vs. a calculated column? I am so glad you asked because I really struggled with this one. This is a tricky one because you often can use either a measure or a calculated column (but that doesn’t mean you should).
什么時候應該進行度量與計算列比較? 您問我很高興,因為我真的很努力。 這是一個棘手的問題,因為您經常可以使用度量或計算列(但這并不意味著您應該使用)。
Things to keep in mind with measures and calculated columns:
度量和計算列要記住的事情:
When you can use either, use a measure
當你可以使用,使用措施
A calculated column is typically used when you want to use it as a filter or slicer or if you want to create categories (e.g. add a column that has “New Employee,” “Employee”, or “Senior Employee” based on their tenure).
當您想將其用作過濾器或切片器或要創建類別時,通常使用計算列 (例如,根據其任期添加具有“新雇員”,“雇員”或“高級雇員”的列) 。
You have to use a measure if you want to calculate something based on what the user has selected (e.g. calculating the total revenue for a department selected in a slicer)
如果要基于用戶選擇的內容進行計算,則必須使用度量 (例如,計算在切片器中選擇的部門的總收入)
If the distinction between calculated columns and measures doesn’t totally make sense right now, that is okay. Try experimenting with creating both a measure and a calculated column and see if they both do what you need them to. If they do, great, use the measure. If just the calculated column works, go with that!
如果現在對計算列和度量之間的區別還不完全了解,那就可以了。 嘗試同時創建度量和計算列,以查看它們是否都滿足您的要求。 如果可以,那么請使用該措施。 如果只是計算出的列有效,那就繼續吧!
功率查詢(M)或DAX? (Power Query (M) or DAX?)
Things got confusing for me here, too, because it seemed like most of what I could do in Power Query/M, I could also do in DAX. Which one am I supposed to use and when?
這里的事情也讓我感到困惑,因為這似乎是我在Power Query / M中可以做的大多數事情,在DAX中也可以做到。 我應該使用哪一個?何時使用?
Short answer: Use Power Query/M when possible. (The big exception here is if you are trying to create a calculated column that references a column in a different table. In that case, use DAX to create a calculated column)
簡短答案 :盡可能使用Power Query / M。 (這里的最大例外是,如果您嘗試創建引用不同表中的列的計算列,在這種情況下,請使用DAX創建計算列)
Long answer: Read this.
長答案:請 閱讀 。

And just like that, you did it! You made it through a basic conceptualization of Power Query, M, DAX, measures, and calculated columns. If you don’t understand all the differences and uses right now, that is perfectly okay! You have laid the foundation, and that is a huge step in the right direction.
就這樣,您做到了! 您通過對Power Query,M,DAX,度量和計算列進行了基本概念化。 如果您現在不了解所有差異和用途,那完全可以! 您已經奠定了基礎,這是朝正確方向邁出的巨大一步。
要記住的事情: (Things to remember:)
- Power Query is where it all begins to bring in and clean your data. Power Query是所有這些功能開始引入并清理您的數據的地方。
M is the language used in Power Query (you don’t have to use M directly, but it makes your life easier in the long run).
M是Power Query中使用的語言(您不必直接使用M,但從長遠來看,它會使您的生活更輕松)。
- DAX is the language used once your data is in Power BI to create calculated columns and measures. DAX是將數據放入Power BI中后用于創建計算列和度量的語言。
If you can do it in Power Query/M, you should (except when you are adding a column to a table that references a column in a different table).
如果可以在Power Query / M中執行此操作,則應該這樣做 (將列添加到引用另一個表中的列的表中時除外)。
If a calculated column or a measure will work, use a measure.
如果計算出的列或度量適用,請使用度量。
下一步: (Next steps:)
The easiest, and fastest, way to get these concepts to stick in your brain are by exposure and practice. Here are some great resources to get started with:
使這些概念深入大腦的最簡單,最快的方法是通過接觸和實踐。 這里有一些很好的入門資源:
SQLBI
SQLBI
Microsoft PBI Learning
Microsoft PBI學習
Power BI Community
Power BI社區
While I highly encourage engaging with all the wonderful resources out there, nothing is going to help you more than by trying things out on your own and seeing what happens.
盡管我極力鼓勵與那里的所有寶貴資源合作,但沒有什么比通過自己嘗試和觀察會發生的事情對您有更多幫助。
Keep banging your head against the wall. It gets so much better.
繼續用力撞墻。 它變得好多了。
翻譯自: https://towardsdatascience.com/power-bi-m-vs-dax-vs-measures-4c77ae270790
本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。 如若轉載,請注明出處:http://www.pswp.cn/news/388081.shtml 繁體地址,請注明出處:http://hk.pswp.cn/news/388081.shtml 英文地址,請注明出處:http://en.pswp.cn/news/388081.shtml
如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!