Row Context in DAX

Row Context in DAX

SQLBI

2 года назад

95,955 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@xXPhixiusXx
@xXPhixiusXx - 09.11.2023 18:50

Another example of why he's one of the GOATs 🐐! 🎉

Ответить
@starcrosswongyl
@starcrosswongyl - 20.08.2023 14:49

How come the =SUMX(FILTER(CUSTOMER,CUSTOMER[Country]="USA"),SUMX(FILTER(SALES,SALES[CustomerKey]=[CustomerKey]),SALES[Quantity]*SALES[Unit Price])) GRAND TOTAL is not showing the right figure?

Ответить
@louism.4980
@louism.4980 - 28.07.2023 17:52

Thank you, love your explanation! :)

Ответить
@timianalytics7150
@timianalytics7150 - 23.07.2023 18:48

Thank you Alberto... Thank God it's weekend, I'll consume a lot of your videos today. Lol

Ответить
@luchoVel
@luchoVel - 21.07.2023 18:49

Thank you Alberto, very useful.

Ответить
@paravej
@paravej - 18.07.2023 06:01

Great.... Now clear about all aggregate function with 'X' and without 'X'
And also understand what is ROW CONTEXT exactly

Thanks a lot!!!

Ответить
@laurenceabrahams3996
@laurenceabrahams3996 - 15.07.2023 10:37

Thank you so much Alberto. You have really explained it well after many years of using Power BI , I now understand it so much better

Ответить
@marcofestu
@marcofestu - 28.05.2023 12:32

Grazie Alberto for the video.
One question, in the measure "Test", shouldn't
RELATEDTABLE (Sales) be used in the second FILTER function?

Ответить
@YassineLaRegardee
@YassineLaRegardee - 09.04.2023 11:35

Hello community, i think a key idea ,that needs to be noticed, is that a measure can be in one of two shapes , either a single value, or a column of values. And that's why we need to sepecify this thing called context row. A calculated column is always in a shape of a serie of values, thus no need to specify a row context.
What do you think guys?!!🙄

Ответить
@sandeepkhawas3367
@sandeepkhawas3367 - 09.04.2023 04:00

Dear sir, good expiation would request please create more video's on power bi !

Ответить
@powerbinareal
@powerbinareal - 17.02.2023 00:32

TOP!

Ответить
@gregoryoliveira8358
@gregoryoliveira8358 - 09.02.2023 11:17

Hi. Someone could explain my something?

I wrote the follwing measure to calculate month average.

Geração Mes =
VAR dataAtual = SELECTEDVALUE(dCalendario[Date])

VAR mesAnoAtual = SELECTEDVALUE(dCalendario[Mes Ano])

RETURN
IF(
DAY(dataAtual) = 1,
CALCULATE(
DIVIDE([Geração Diaria], COUNTROWS(dCalendario)),
FILTER(ALL(dCalendario), dCalendario[Mes Ano] = mesAnoAtual)
)
)

I tried to apply a combination between AVERAGEX and SUMX, but I didnot work.

In other hand, I tried to use EARLIER instead of SELECTVALUE. However, this did not work.

I dont have performance isues with this measure, but I really want to understand where I lost myself in the conceptions.

Thanks.

Ответить
@pantomima5841
@pantomima5841 - 28.01.2023 13:03

You are awesome.

Ответить
@zelim9863
@zelim9863 - 28.12.2022 23:09

First of all, many thanks for such great video. I have question, why when you wrote measure as column SUMX(Sales, Sales[Quantity] * Sales[Unite Price]) we get grand total whereas when you write it as measure it works differently(meaning filter context works and it calculates row by row). If anyone can explain it to me I will highly appreciate :)

Ответить
@oscarparadajr
@oscarparadajr - 28.12.2022 16:27

This was a FANTASTIC video on Row Context! I know have a much better understanding of this concept and the roles that an iterator plays. Thank you so much!!!!!!

Ответить
@robertkiermasz4513
@robertkiermasz4513 - 22.11.2022 13:08

Very good, easy to understand now.

Ответить
@ianalvarez7953
@ianalvarez7953 - 14.11.2022 16:37

Wonderful video alberto, so we can say that a row context its in a nutshell, a for loop right?

Ответить
@tacijjola
@tacijjola - 14.11.2022 14:48

Wonderful! That's exactly what I needed to get started with DAX. Thank you very much Alberto for sharing your DAX wisdom.

Ответить
@karannchew2534
@karannchew2534 - 10.11.2022 23:49

Notes for future revision.

Row context exist in:

1. Calculated column. By definition - a column consists of rows, and values are calculated row by row.

Amt = sales[qty] * sales[price]
_Works for creating new column, where Amt is calculated row by row, by default.


2. Measure that include table iteration, FunctionX()

Amt = SUM(sales[qty]) * SUM(sales[price])
_Work correctly only in certain situations e.g. the filter (of the the table or visual) is at the lowest granularity e.g. per row, per day per sale per customer.
_Works also at aggregated level e.g. per month, but it gives wrong result. As it gives Total A of all rows x Total B of all row, instead of Total of "AxB of each row".

So, to calculate Amt correctly,
need to first do sales[qty] * sales[price] row by row,
then sum the results from all rows.

How?
How to first multiply row by row, then sum?
Use an X function that iterates row by row. In this case SUMX.

How to first multiply row by row, then sum?
SUMX (row by row multiplication)

But which row of what table? Specify the table!
SUMX (table_name, row by row multiplication)

Similarly, to get an average of a ratio:
AVERAGEX (table_name, row by row division).

For FUNCTIONX( table_name, expression_formula), just imagine a new column of is created in table_name, with value from expression_formula for every row. Then, FUNCTION is applied to all rows

Ответить
@amjadzahid
@amjadzahid - 09.11.2022 11:41

We are blessed to have "SQLBI". Thank you!

Ответить
@tomaszs.4811
@tomaszs.4811 - 08.11.2022 19:25

This video is simply great - very well presented and explained

Ответить
@LookNumber9
@LookNumber9 - 06.11.2022 18:03

What a wonderful teacher. Beautifully done. Thank you!

Ответить
@livenere
@livenere - 12.10.2022 13:20

How are Dax expression executed? Does the calculation starts from the center out, or the out to in?

Ответить
@vdweghp
@vdweghp - 01.09.2022 12:02

Sir, you are the best, period !

Ответить
@melvin9993
@melvin9993 - 23.08.2022 04:29

Great as always

Ответить
@trilokinathsingh5705
@trilokinathsingh5705 - 16.08.2022 21:35

please share the series wise index

Ответить
@gborka
@gborka - 03.08.2022 22:30

Thank you for sharing, really great idea to build the understanding layer by layer:
*Row Context
*Filter Context
*CALCULATE Function
*Context Transition

Ответить
@michele37276
@michele37276 - 20.07.2022 10:00

Ciao Alberto, i am new to Power bi and i really appreciate this video(the First i m going through). It Is extremely useful, thanks so much

Ответить
@AkshayKumar-vd5wn
@AkshayKumar-vd5wn - 05.07.2022 10:18

Thank you for this lesson. I have a question - What is the main goal of this DAX?

First it picks the the country USA from Customer, then filters Sales condition and then the final If condition on the Sales condition right?
So what will this Dax produce?


Edit:
Also may I inquire why you used Sumx when you could have used Sum if you wanted to get only the totals. Example: Sum(Filter(
Any reason I am missing for using Sumx.

Ответить
@jgarale
@jgarale - 01.07.2022 23:34

thank you very much for the video!!! :D

Ответить
@MrAbrandao
@MrAbrandao - 16.06.2022 05:28

how to create a row context in a measure if the data is text?

Ответить
@3pandya
@3pandya - 12.06.2022 18:05

Thank you so much for this video. You explained it really nicely.

Ответить
@gilbertosegoviano7701
@gilbertosegoviano7701 - 28.05.2022 07:13

Thank you so much for the time that you give to explain us. That is amazing

Ответить
@MahadiHasan-qk5ko
@MahadiHasan-qk5ko - 15.05.2022 11:04

That means every iterator function works as a row context when creating a measure. I mean SUMX, AverageX....etc.

Ответить
@Wzxxx
@Wzxxx - 14.05.2022 09:52

Very nice explanation. Probably best i have ever watched. Finally! Thank You
The code comment in green explains a lot. Such a niuance

Ответить
@niavras
@niavras - 10.05.2022 13:55

Thank you! Great axplanation!

Ответить
@ed-0075
@ed-0075 - 05.05.2022 03:53

Very good video! Thank you! :)

Ответить
@lukereds9975
@lukereds9975 - 30.04.2022 17:57

very good job, ottimo lavoro grazie!

Ответить
@RyanReynolds89
@RyanReynolds89 - 18.04.2022 01:51

I know this is more advanced than the video is aiming for, but:
in the final code with stacked row contexts, does the concept of Expanded Tables factor in at all?

Ответить
@MarciusMGSouza
@MarciusMGSouza - 17.04.2022 15:49

Very nice!

Ответить
@scramiro1
@scramiro1 - 14.04.2022 10:49

Great video! Hope there is a Playlist that aggregates this video with other concept videos.

Ответить
@sergiocaptuleio1088
@sergiocaptuleio1088 - 14.04.2022 03:27

A última medida foi SHOW!!! Mas uma dica sobre contexto. Parabéns!!!!!

Ответить
@Gaist-zj8tq
@Gaist-zj8tq - 13.04.2022 09:22

thanks very useful as Always

Ответить
@jasKSG
@jasKSG - 13.04.2022 07:55

Alberto is the nested SUMX in the end another way of computing something complex from our Fact Table (many side) in our filtering table (1 side) but without calculated column - with column we usually use COUNTROWS.... RELATEDTABLE() but looks to me that Sales[CustomerKey] = Customer[CustomerKey] in the nested sumx could achieve tha same if written correctly

Ответить
@wayneedmondson1065
@wayneedmondson1065 - 12.04.2022 04:57

Very nice tips! Thanks for demonstrating. Thumbs up!!

Ответить
@vietndk5437
@vietndk5437 - 05.04.2022 21:51

Actually, your explanation requires some effort to understand well about the row context and filter context. But once I got it, it blows my mind. Thanks Alberto. Great video.

Ответить
@MaestrosounD
@MaestrosounD - 02.04.2022 21:12

Nice video, Alberto. It actually is a nice addition to the explanation you gave me about context transition earlier today. It definitely is more clear for me now!

Ответить
@pbihari0214
@pbihari0214 - 02.04.2022 17:15

thank you

Ответить