Measures vs. calculated columns in DAX and Power BI

  Рет қаралды 238,481

SQLBI

SQLBI

3 жыл бұрын

What are the differences between measures and calculated columns in DAX and Power BI? All the answers in this short video. Do you want to know more?
Start with Introducing to DAX free course: www.sqlbi.com/p/introducing-d...
Go deeper with Mastering DAX: www.sqlbi.com/p/mastering-dax...
Complete guide on how to learn DAX: www.sqlbi.com/guides/dax/?aff=yt

Пікірлер: 83
@geniecy3117
@geniecy3117 2 жыл бұрын
Just found this video and what an eye opener for beginners like me. I always try to create new measure than add a calculated column. This is indeed helpful! Thank you!
@gracealexandragonzalez7022
@gracealexandragonzalez7022 3 жыл бұрын
Wow this is the best explanation I have seen about this difference
@apamwamba
@apamwamba 3 жыл бұрын
Excellent... I am now getting it and ready to learn DAX on a serious note....
@MatteoLacava
@MatteoLacava 2 жыл бұрын
Alberto sei un grande! Best explanation so far!
@user-tn3iy6qw6n
@user-tn3iy6qw6n 6 ай бұрын
God bless you for all the useful Tips and Tricks you are teaching to us.
@cunhainformatica1601
@cunhainformatica1601 10 ай бұрын
Very good and direct to the point. Thanks for this video.
@balaji_906
@balaji_906 3 жыл бұрын
Thanks for explaining the differences.
@jstbe
@jstbe 3 жыл бұрын
Thanks a lot!, a really good explanation.
@usharanijs
@usharanijs 8 ай бұрын
Very Clear Explanation... Thank you...
@bennguyen4409
@bennguyen4409 3 ай бұрын
Beautiful, this was exactly what I needed clarified! Thank you!
@sickandarnavab4891
@sickandarnavab4891 2 жыл бұрын
Very nice and able to understand now between computed and measure, well done
@humayunshahzad9181
@humayunshahzad9181 Жыл бұрын
Great example.. many thanks
@vrajtalati5300
@vrajtalati5300 10 ай бұрын
Great Explanation!!
@eljangoolak
@eljangoolak 2 жыл бұрын
Ciao friends --> got the like! also who couldn't possibly like wonderfully useful content form a person with the last name of Ferrari! amazing video, thank you
@Juan-Hdez
@Juan-Hdez Жыл бұрын
Very useful. Thank you.
@bt1530
@bt1530 3 жыл бұрын
May I call you professor? Thank you professor Alberto for explaining the differences.
@Milhouse77BS
@Milhouse77BS 3 жыл бұрын
I’ve learned from experience to avoid calculated columns for large fact tables, especially with partitions.
@Bexckers
@Bexckers Жыл бұрын
Can you explain why?
@RajendraPatel.
@RajendraPatel. 3 ай бұрын
Awesome logic 😊
@AndyRowarth
@AndyRowarth 7 ай бұрын
create video, leant alot about the differences. thanks
@greggapowell67
@greggapowell67 Жыл бұрын
thank you. Exceptional.
@poojasingh-re1fw
@poojasingh-re1fw 2 жыл бұрын
Clear explaination
@shivasai25
@shivasai25 2 жыл бұрын
Amazing information Where I can find more scenarios on DAX to master it Can you guide me in this.
@ricksanchez6356
@ricksanchez6356 3 жыл бұрын
For some reason measures have always eluded me. This has helped, but I think I still need some practice ^_^
@arjv5998
@arjv5998 2 жыл бұрын
Excellent
@amakaamaka3959
@amakaamaka3959 3 жыл бұрын
wow.........am in love now DAX
@anjucaesar93
@anjucaesar93 8 күн бұрын
Good information
@prateeklowalekar8777
@prateeklowalekar8777 3 жыл бұрын
Hi, thanks for the explanation. Can you please tell me how did you enable the tabs for Measure tools/column tools? Or is it a third party add-in
@SQLBI
@SQLBI 3 жыл бұрын
When you install the latest version of these tools (DAX Studio, Tabular Editor, Analyze in Excel for Power BI Desktop, ALM Toolkit) that tab appears automatically. Tool links available at www.sqlbi.com/tools/
@vdweghp
@vdweghp Жыл бұрын
OMG, this is 1 + 1 = 2 finally well explained...
@csrajaraman
@csrajaraman 3 жыл бұрын
Thank you for the explanation. Can you use a measure to create a calculated column? I am trying to get a date value from slicer, and storing the value in a measure. I want to use that date value to create a new column. But I get the same value for all the rows.
@SQLBI
@SQLBI 3 жыл бұрын
Yes, a measure referenced in a calculated column will get the context transition from row context to filter context.
@MrAbrandao
@MrAbrandao Жыл бұрын
I really was hoping that you would show how to turn that calculated column code into a measure
@chirantan96
@chirantan96 3 ай бұрын
Thanks!
@hamidsh4789
@hamidsh4789 2 жыл бұрын
Thanks
@matheww9944
@matheww9944 Жыл бұрын
Could I ask another question, I've just bought your book The Definitive Guide to Dax (2nd Ed) and I'm reading about leveraging the performance between calculated columns and Measures, If you separate your Dataset from your visual model, would that not improve performance if you used Calculated columns vers Measures on your visuals?
@SQLBI
@SQLBI Жыл бұрын
From a performance point of view, it's better to keep calculated columns on the same model, not on a remote model. However, oftentimes calculated columns are not required for performance and they just increase model size and slow down refresh. Do your own evaluation!
@marksantos1735
@marksantos1735 3 жыл бұрын
I'm somewhat distracted with the accent but nice explanation. No doubt that he is the pioneer of DAX.
@HarmanHundal01
@HarmanHundal01 3 жыл бұрын
4 points summary 1. If you want to slice and dice by a column, use a calculated column 2. If you want to use a filter context, use a calculated column 3. If you want to consume less data for storage, use a measure 4. Prefer measures over a calculated column wherever possible
@cheetah9839
@cheetah9839 2 жыл бұрын
A measure is evaluated in the context of the cell evaluated in a report or in a DAX query, whereas a calculated column is computed at the row level within the table it belongs to
@cheetah9839
@cheetah9839 2 жыл бұрын
Calculated columns are computed during the database processing and then stored in the model. Measures are not stored in the model as they are computed at query time and do not use memory
@cheetah9839
@cheetah9839 2 жыл бұрын
If you need to operate on aggregate values you must create measures,If you need to operate on a row-by-row basis, you must create calculated columns
@haiyennguyen9067
@haiyennguyen9067 Жыл бұрын
2. Filter context is used in measure, not calculated column.
@qingtaoshi3578
@qingtaoshi3578 Жыл бұрын
Thank you for your video. I am curious if you have Italian accent. 🙂
@Bharath_PBI
@Bharath_PBI 3 жыл бұрын
Thanks for the content, and just for clarification, would like to know this.. The line amount calculated column had same values in the table where as it was still getting huge different incorrect values under the filter context when used in the visual.. I Believe that this is because of the number of rows that gets evaluated in the filter context giving different wrong results, otherwise if rows are equally distributed then we would see same wrong result in the visual.. can you please confirm.
@SQLBI
@SQLBI 3 жыл бұрын
I don't understand your description, please can you try to clarify your question?
@Bharath_PBI
@Bharath_PBI 3 жыл бұрын
@@SQLBI Sorry for that, I was justifying the reason for seeing different values in the visual.. even though same values appear in Calculated column..
@DJ_Q
@DJ_Q 2 жыл бұрын
@@Bharath_PBI You're seeing different values in the visual because it's being filtered by brand. In each row, it's aggregating the grand total by the total number of rows that contain each brand. So for example, if the number 10 is repeated in the calculated column, and a product of brand X appears 9 times and a product of brand y appears 10 times and there are actually 1000 rows, in this example, brand X will show 90 (9 * 10) and brand y, 100 (10 * 10) whereas the grand total of all brands will be 10,000 (1000 rows with 10 repeated) I hope this explanation helps. I'm only a year and a half into this so I'm open to correction.
@pablocesarteixeirahoyos5009
@pablocesarteixeirahoyos5009 Жыл бұрын
The GOAT
@90s_HipHop
@90s_HipHop 3 жыл бұрын
My question - off the back of this video, why would you use a calculated column instead of pre-calculating this in PowerQuery?
@SQLBI
@SQLBI 3 жыл бұрын
You're right, you should use calculated columns when Power Query would be too expensive - for example computing the value based on the content of other tables could be very slow in Power Query.
@Mike-yz7dv
@Mike-yz7dv Жыл бұрын
I had a question in the interview: where is better to use a calculated column instead of measure and I stucked up. Please help🙏
@SQLBI
@SQLBI Жыл бұрын
It depends! But a calc column is necessary only when you use the result as a groupby or filter column.
@luuminhvuong
@luuminhvuong 2 жыл бұрын
i have a customer contract table with start and end date. and i want to sum the sales from the sales fact table ( bêtween the start -end date) for each contract, do you have any suggestion , tried many articles but still not yet have soltuoons
@SQLBI
@SQLBI 2 жыл бұрын
See this: www.daxpatterns.com/events-in-progress/
@luuminhvuong
@luuminhvuong 2 жыл бұрын
@@SQLBI but the example given is only 1 fact table so might be easier to do , here I have a 2 table separately : sales orders table , and the other is the "contract table" ( which is like a campaign with start and end date , wanna see the sales during each campaign )
@SQLBI
@SQLBI 2 жыл бұрын
It really depends on many details about the report you want to produce. If there are no multiple active campaign for the same date, you should apply the active campaign to the transaction, if there could be multiple campaigns active for a single transaction you should keep the calculation at runtime. There are several discussions about similar problems in our book, even though not exactly the one you asked for: www.sqlbi.com/books/analyzing-data-with-microsoft-power-bi-and-power-pivot-for-excel/
@luuminhvuong
@luuminhvuong 2 жыл бұрын
I'm going to buy this book and learn more, don't know if it helps since the problem not quite the same as you said. Between this book and the defenitive guide to Dax ? which would u recommedn more?
@SQLBI
@SQLBI 2 жыл бұрын
The Definitive Guide to DAX is about the DAX language. Analyzing Data with Microsoft Power BI and Power Pivot for Excel is about data modeling. They cover different topics, you need knowledge on both areas. If you already know dimensional modeling (Kimball's methodology) then you only need DAX, but the question you raised is a typical data modeling question!
@AliciaMueller-es8te
@AliciaMueller-es8te Жыл бұрын
How many minutes in one mile
@matheww9944
@matheww9944 Жыл бұрын
I think this needs updating 2:14 you talk about not being able to slice by a measure, I think this is now possible. 😀
@SQLBI
@SQLBI Жыл бұрын
You can apply a filter on a visual based on a measure only in the filter pane, but you cannot group by a measure.
@matheww9944
@matheww9944 Жыл бұрын
@@SQLBI Many thanks for the clarification
@jessamhan
@jessamhan 3 жыл бұрын
Hi Alberto - my two cents: A measure is a closed unit of aggregation that returns a scalar result. The input of a measure is the current evaluation context. No row context exists prior to executing a measure. A calculated column is the result of a DAX expression. The input of a calculated column is a single row row-context. No filter context exists prior to executing the calculated column. No number of CALCULATEs can make a DAX expression into a measure. Only the DAX engine can do that. It ‘s a closed deal so to speak.
@SQLBI
@SQLBI 3 жыл бұрын
The first two paragraphs are certainly correct. I don't completely understand the meaning of the last one. Can you clarify?
@jessamhan
@jessamhan 3 жыл бұрын
@@SQLBI What I mean is that there is a notion circulating that if you embed a DAX expression in two CALCULATEs that is the equivalent of a measure. CALCULATE(CALCULATE(expression, filter_1, … filter_n)) The justification for this would be that no row contexts are visible to neither the expression nor the filter arguments. If this was correct you should be able to reference a variable declared outside a measure from within a measure. So if you have a calculated column with this DAX expression: VAR aVariable = something RETURN CALCULATE(CALCULATE(expression * aVariable , filter_1, … filter_n)) and you actually could save CALCULATE(CALCULATE(expression * aVariable , filter_1, … filter_n)) as a measure you should be able to do this: VAR aVariable = something RETURN [expressionAsAMeasure] Obviously you can't. A DAX expression becomes a measure when you save the expression as a measure from a client tool that adds the appropriate Meta data AND the DAX expression is isolated from the outside world except for the current evaluation context. Measure = { measure metadata + evaluation context + DAX expression } So a measure is a closed deal (a Closure?). I probably shouldn't have written the last paragraph in my original comment :-)
@SQLBI
@SQLBI 3 жыл бұрын
Yes and no. You can replace any measure with CALCULATE ( ) However, you cannot replace CALCULATE ( ) with [m] where m := , because the visibility of the variables is different. This has nothing to do with the filter context and the row context, but just with the scope of the variables, that is always local to an expression. I hope it helps!
@Getaneh188
@Getaneh188 3 жыл бұрын
Calculated tables: Take up space Created using operators. Measures: No take space Use DAX
@jacobmurray6731
@jacobmurray6731 2 жыл бұрын
I really don't see the point of measures. I would always want to see row by row calculations, and if I wanted to see a sum the pivot tables would show that anyway.
@SQLBI
@SQLBI 2 жыл бұрын
For example, this calculation should be in a measure, otherwise it cannot be aggregated correctly in a grand total if calculated row by row: Margin % = [Margin] / [Sales Amount]
@jacobmurray6731
@jacobmurray6731 2 жыл бұрын
@@SQLBI I use Power Pivot exclusively for outputting tables and pivot tables to the workbook and so far cannot find a use for measures. Maybe this is different in Power BI reports.
@alvarorodriguezlasso
@alvarorodriguezlasso 2 жыл бұрын
Better explalin: imposible
@powerbis.1794
@powerbis.1794 Жыл бұрын
DAX A DAX A DAX A AMORE MIO
@Matias-eh2pn
@Matias-eh2pn Жыл бұрын
I want to eat some pizza!
@navinrangar2626
@navinrangar2626 Жыл бұрын
latino speaking english is amusing xD
@Project_88
@Project_88 2 жыл бұрын
"you can not use the same code for a Measure and a Column" !! This is why DAX and Power Query didn't turn into a success! No matter how hard MS pushes. Why should a learn 2 langs and techniques for one task ??? Microsoft's failure to see obvious things. Otherwise this is the best, most relevant and robust tool for any Big Data/Data Science.
@human_hope
@human_hope Жыл бұрын
Well that's frustrating but the fact that power query can't store measures there had to be probably different languages. Also the syntax for measures is quite different from columns which is another annoying thing.
@stuckinamomentt
@stuckinamomentt 2 жыл бұрын
Not a good explanation
@urband554
@urband554 Жыл бұрын
Unclear
@Truth-N-Lies
@Truth-N-Lies 2 жыл бұрын
Salute
Computing totals by summing visible values in DAX
4:15
SQLBI
Рет қаралды 71 М.
📊 How to use Power BI DAX - Tutorial
37:28
Kevin Stratvert
Рет қаралды 1 МЛН
UFC Vegas 93 : Алмабаев VS Джонсон
02:01
Setanta Sports UFC
Рет қаралды 207 М.
Пробую самое сладкое вещество во Вселенной
00:41
TRY NOT TO LAUGH 😂
00:56
Feinxy
Рет қаралды 18 МЛН
Row Context in DAX
20:42
SQLBI
Рет қаралды 92 М.
When to add a MEASURE and when to add a Column in DAX
7:59
Power BI DAX Tutorial (2/50) - What is Measure or Calculated Column
13:57
Analytics with Nags
Рет қаралды 103 М.
How and where to write DAX Measures for Power BI and Excel
14:02
MyOnlineTrainingHub
Рет қаралды 76 М.
How charged your battery?
0:14
V.A. show / Магика
Рет қаралды 6 МЛН
Iphone or nokia
0:15
rishton vines😇
Рет қаралды 1,8 МЛН
ПОКУПКА ТЕЛЕФОНА С АВИТО?🤭
1:00
Корнеич
Рет қаралды 2,8 МЛН
сюрприз
1:00
Capex0
Рет қаралды 1,5 МЛН
Apple watch hidden camera
0:34
_vector_
Рет қаралды 65 МЛН