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.mzph.cn/news/388081.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!