NEW OFFSET Function in DAX | Will It Change How You Write DAX?

NEW OFFSET Function in DAX | Will It Change How You Write DAX?

How to Power BI

1 год назад

56,122 Просмотров

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


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

@Michella1393
@Michella1393 - 11.10.2023 12:24

Hi, thanks for the amazing tutorial! I am trying to use the offset function to calculate the previous calendar week in a calculation group. It does not work, do you have an idea on how it works?

Ответить
@nancylalicon4192
@nancylalicon4192 - 26.09.2023 23:23

Thanks so much for the clear explanation on how to use OFFSET.... I think you just changed my life!

Ответить
@Phoenixspin
@Phoenixspin - 24.06.2023 03:24

I clicked because I thought this was about Cardi B's husband, Offset.

Ответить
@BokangMaela
@BokangMaela - 15.03.2023 12:16

Will this offset function work if for example do something like CurrentColumn = var previousevalue = Calculate([CurrentColumn], Offset(-1)).

Ответить
@rachelrdyer
@rachelrdyer - 12.03.2023 21:26

great job, thanks very much! I appreciate the effort with the work arounds and also the candid assessment of it's usefulness.

Ответить
@inj1979
@inj1979 - 27.01.2023 21:51

Thanks. 🍓

Ответить
@hadi11911
@hadi11911 - 26.01.2023 17:14

So can you use this to evaluate a result in a row based on the result in the row above, of the same column. practical example case is when you are calculating projected stock, you need to refer the calculation to the projected stock of the previous month to evaluate the projected stock of the month. WOULD APPRECIATE YOUR ASSIST.

Ответить
@Saif_Ali_Khan_1301
@Saif_Ali_Khan_1301 - 19.01.2023 07:13

you are genius, how do you decide, when we should select All, SelectedAll, SelectedValue, Summarize, or Summarize COlumns
do you have case studies for these?

Ответить
@umangdbz
@umangdbz - 07.01.2023 18:28

Hey bro, for the multiple fields part, can we simply include the desired field in relation and orderby arguments instead of partition?

Ответить
@storybi4636
@storybi4636 - 03.01.2023 06:23

I love how you explain things by showing the Excel equivalent, then showing how the function works in Power BI. I tried the OFFSET function and it worked great! Seems like an alternative to the prior pattern, FILTER(ALL(Time.

Ответить
@fumaremiocazzo
@fumaremiocazzo - 29.12.2022 12:50

Is there any other option for gaining the same result, especially for the month/total sales example, beside the offset - orderby functions, since my version of power BI can't recognize it?

Ответить
@mubeenxp8502
@mubeenxp8502 - 22.12.2022 16:45

Great

Ответить
@vishaljhaveri7565
@vishaljhaveri7565 - 20.12.2022 09:16

One of the best explanation about OFFSET. Thank You.

Ответить
@juanpablovivar1088
@juanpablovivar1088 - 07.12.2022 22:54

Hello, thanks for your video, please i have a doubt, i try to create measure, all is good but the total is empty, this the code with offset, thanks very much

TEXTO_ANTERIOR =
VAR FILA =
SUM(ejemplo[TEXTO])
VAR fila_anterior =
CALCULATE(
sum(ejemplo[TEXTO]),
OFFSET(
-1,
ALL(ejemplo),
ORDERBY(ejemplo[FECHA_EVENTO_DATE_HORA], ASC)
)
)

VAR previous_corregida=

IF(fila_anterior=fila,0,FILA)


RETURN
previous_corregida

Ответить
@ozansen_ozibaba
@ozansen_ozibaba - 05.12.2022 17:57

This is by far the best explanation about offset! It reminds us of window functions in SQL (LAG and LEAD) as somebody wrote it! I also liked your workarounds!

Ответить
@Drengen10
@Drengen10 - 17.11.2022 20:00

Wonder if it can be used to calculate rolling totals that are "complex"

Ответить
@sherifffruitfly
@sherifffruitfly - 06.11.2022 19:20

Can the first param of OFFSET() be a scalar valued expression? Or does it have to be an explicit fixed constant?

Ответить
@allyoucaneats
@allyoucaneats - 29.10.2022 00:53

This does not work for multiple group bys

Ответить
@Negi_From_Pauri
@Negi_From_Pauri - 28.10.2022 10:58

Hey pal i am big fan of yours, "POWER BI"☺ i have a question about power query we can undo(means delete) the step, So is there any way we can redu(means to get last deleted step) the step. Deleted step could be in any line in applied steps. I am asking because sometimes the step is big we write m query so that we just can redu the step instead of to write m query again.

Ответить
@subhajyotibhattacharyya3416
@subhajyotibhattacharyya3416 - 13.10.2022 11:54

Hi I'm having a error after using offset saying "It is not a valid table, variable, or function name." . Can you please tell me why this is happening🧐🧐🥸

Ответить
@YvdB
@YvdB - 11.10.2022 09:52

To do it over a longer period you could combine Year & Month in one column. "YYYY-MM"

Ответить
@andysuzhou7956
@andysuzhou7956 - 11.10.2022 00:02

It reminds me of the infamous EARLIER function, when we try to get the previous row in a dataset; an impossible task in direct query mode. Now it's possible, even it's not the most performant solution. Power Bi is getting better!

Ответить
@musl1618
@musl1618 - 10.10.2022 08:00

🔥🔥🔥🔥

Ответить
@muralimohan71
@muralimohan71 - 08.10.2022 14:30

Is it possible to perform similar operations in matrix visual. I want to compare the value from previous cell in same row with current row to calculate difference and highlight the current cell value as green if difference is positive and red if difference is negative.

I have a matrix visual where I need to highlight the cells in a Matrix visual when value is increased or decreased compared to previous column value in same row.

Please help me if it is possible. Thank you 😊😊

Ответить
@tibobago
@tibobago - 07.10.2022 11:17

Thanks Bas. Love the examples. I would just call out that while adding the total sales by manufacturer work in your example, it's not dynamic anymore and if a filter was to change the rank of the manufaturers in that filter context, it won't take that context in consideration in the result as it's pulling from the column value. So by example if a manufature ranks 2nd overall, as filters get applied, it could change to 3rd rank but would still be considered as 2nd in your measure... would love to find another workaround that would keep it fully dynamic! I think there's great potential to have fun with that new function, maybe squeezing some field parameters, calculation groups and a slicer to select the offset value on top 🙂

Ответить
@peterhui2452
@peterhui2452 - 06.10.2022 18:15

Thank you for this great video !

Is there a way to use offset to return a text value instead of a numeric ??

Ответить
@omariscoming5018
@omariscoming5018 - 06.10.2022 14:48

this is huge, so many workaround needed before to this simple thing

Ответить
@remek5758
@remek5758 - 06.10.2022 11:10

Thats great that they bring it in, but i Think Old Dev will anyways use old Time Int functions are just dateadd for custom ones, it's not to big deal I think, this may be goof for new power bi users who knows offset from excel

Ответить
@roverre61
@roverre61 - 06.10.2022 11:06

Dear Buz, I am very fascinated by the way you manage to explain in such a simple and clear way, thousands of pages of Microsoft instructions .... !!! 😄 congratulations...!!

It would also be very interesting if you could dedicate some video tutorials about the "Power BI report builder" application to make structured reports that can be printed...Can you do It for us?
Many thanks and Bravissimooooooo 👏👍

Ответить
@hlee6239
@hlee6239 - 05.10.2022 22:40

Lovely lecture! I found your channel is the most helpful! TYTY

Ответить
@ernests4066
@ernests4066 - 05.10.2022 18:59

Thank you for this video, this function is so helpful (to be honest in Tableau different to the next value is super easy, but in PBI it was more challenging), now delta to the next is also easy in PBI, 5!

Ответить
@dizzyharris2658
@dizzyharris2658 - 04.10.2022 16:16

For time intelligence, couldn't you sort by YearMonth Number? Then adjust the var to IF( [YYYYMM] > MIN( [YYYYMM] ), [Total Sales] - SalesOffset )

Ответить
@braedonbrown2973
@braedonbrown2973 - 04.10.2022 15:59

Would concatenating year and month in a “yyyymm” format and sorting by that value for month name theoretically work for the JAN values when using the offset and orderby functions together?

Ответить
@paulmfti
@paulmfti - 04.10.2022 08:05

Already saw this….

Ответить
@gagansingh3481
@gagansingh3481 - 04.10.2022 05:51

I can't understand how it works for manufacturer column and not for month as both are text

Ответить
@aqavi263
@aqavi263 - 04.10.2022 04:53

Good work Bas, appreciate your in-depth efforts. I like how you played around with workarounds and explored all tricks to make this work in preview.
Demonstrating what does not work, to understand its best use case, is also very important.

Ответить
@cesarsaldana3429
@cesarsaldana3429 - 04.10.2022 03:37

Amazing!!!!! The community has been crying out for this feature for a long time.

Ответить
@nickcraft5552
@nickcraft5552 - 03.10.2022 22:33

Great video! Time intelligence calculations are still frustration. I recently found a solution to such a problem like the one in your example using TREATAS and braces{} to define a table within a table. cc.Previous_Year_Patients =
VAR __previous_Year = DATE( [YEAR], 1, 1 )-1
VAR __previous_Patients =
CALCULATE(
SUM ( TB_POP[Patients]),
TREATAS( {__previous_YEAR} , TB_POP[YEAR] ),
ALLEXCEPT( TB_POP, TB_POP[Zip Code] )
)
RETURN
__previous_Patients

Ответить
@XopherA
@XopherA - 03.10.2022 20:44

Here is a possible practical use - offsetting weeks, since there's no native time intelligence for that.

Ответить
@vijayarjunwadkar
@vijayarjunwadkar - 03.10.2022 14:25

Interesting function to know! Thank you Bas for covering in detail, but will require a bit more time and efforts to understand and use it better. Of course, as it is yet to be released, we might see the functionality that you wished for and demonstrated with work arounds actually appear, fingers crossed!

Ответить
@tjitzeweisma7033
@tjitzeweisma7033 - 03.10.2022 14:16

Thanks for sharing. It will work nicely for company specific period codes, as we now easily can calculate the deviation to the previous period.

Ответить
@1yyymmmddd
@1yyymmmddd - 03.10.2022 13:45

Good function, but don't we lose possibility for customer to sort any column him/herself?

Ответить
@casingena1985
@casingena1985 - 03.10.2022 13:12

Thanks Bas, it's always good to also show what doesn't work and why, so from me thanks for including these bits rather than leaving them on the cutting room floor :)

Ответить
@PeterKontogeorgis
@PeterKontogeorgis - 03.10.2022 08:57

Nice analysis Bas. Was quite intrigued when I read about this a few days ago. Potentially could be great if they can get make it easy enough to use.

Ответить
@Tubasnot
@Tubasnot - 03.10.2022 05:41

Thank you for sharing and providing examples and solid explansions on the usage of the new OFFSET. Totally agree that it might not be super useful currently, but shows that there is potential once it gets refined a bit. Cheers!

Ответить
@normandtousignant1754
@normandtousignant1754 - 03.10.2022 03:33

Great presentation

Ответить
@andrewcoventry7246
@andrewcoventry7246 - 03.10.2022 00:20

should make calculating moving ranges a lot easier, so for XMR charts will help a lot!

Ответить
@MrSparkefrostie
@MrSparkefrostie - 03.10.2022 00:19

I think this is going to help witg the super conplex dax i put together a while back. I need to calculate the time difference between 2 time stamps. The durations are milliseconds but the difference could be seconds to days.

Ответить