DATEADD, SAMEPERIODLASTYEAR - DAX Guide

Поділитися
Вставка
  • Опубліковано 7 лис 2024

КОМЕНТАРІ • 16

  • @byungheekim349
    @byungheekim349 2 роки тому +1

    Thank you so much. I have one question. May I use variant when I use DATAADD function at "number of interval" instead of -1 or +1 ?

  • @markolukic6760
    @markolukic6760 Рік тому

    Can I use it for weeks compurgation, same WEEKNUMBER last year?

  • @mikerowan3017
    @mikerowan3017 2 роки тому +1

    Great video! Could you make a similar video that looks at calculating the same day of week in a different period instead of date? For example, you want to compare the first Saturday in July to the first Saturday in June which fall on different dates. Day of week comparisons play an important role in retail and service analytics. Thank you!

    • @SQLBI
      @SQLBI  2 роки тому

      Look at the DAX Patterns for week-related calculations: www.daxpatterns.com/week-related-calculations/

  • @erinfield1943
    @erinfield1943 2 місяці тому

    0:29- SAMEPERIODLASTYEAR
    1:14- DATEADD

  • @williamarthur4801
    @williamarthur4801 Рік тому

    I have seen dateadd used wiht datesbetween and lastdate
    CALCULATE( [TotalU], DATESBETWEEN( 'Calendar'[Date], DATEADD(LASTDATE('Calendar'[Date]),-1, MONTH),LASTDATE('Calendar'[Date]) ) )
    I have always just subtracted the number of days or used EDATE (MAX( date), n ))
    Are there any problems in using DATEADD LASTDATE in this scenario or am i being overly cautious?

    • @SQLBI
      @SQLBI  Рік тому

      EDATE is faster, DATEADD and LASTDATE are table functions, but DATESBETWEEN need scalar values, so you are introducing unnecessary conversions along the line.

    • @williamarthur4801
      @williamarthur4801 Рік тому

      @@SQLBI Thanks for the response, it struck me as a method that, even though it worked could have problems. I shall stick to EDATE.

  • @PicaPauDiablo1
    @PicaPauDiablo1 2 роки тому +1

    Thank you!

  • @pbihari0214
    @pbihari0214 2 роки тому +1

    Thank you

  • @ravitejak9414
    @ravitejak9414 8 місяців тому

    I am getting circular dependency issue with it

  • @alejandrogonzalezcolin4475
    @alejandrogonzalezcolin4475 Рік тому

    I have tried the following but I always get error, what's wrong?
    ---------
    ERROR: A function 'PLACEHOLDER' has been used in a True/False expression that is used as a table filter expression. This is not allowed.
    ---------
    CALCULATE(
    CALCULATE(DISTINCTCOUNT('04_ventas_saturacion'[Material]),
    SAMEPERIODLASTYEAR(Dim_Calendar[Fechas])
    ),
    Dim_Calendar[Fechas] >= DATE(2023,1,1) &&
    Dim_Calendar[Fechas]

    • @SQLBI
      @SQLBI  Рік тому +1

      Check this article/video: www.sqlbi.com/articles/solving-errors-in-calculate-filter-arguments/

    • @alejandrogonzalezcolin4475
      @alejandrogonzalezcolin4475 Рік тому +1

      @@SQLBI Thank you, excellent explanation, I love this channel because they always touch advanced topics explained in a simple way.

  • @zerayacobhabemariam2726
    @zerayacobhabemariam2726 2 роки тому

    Can you make a video on how to get dax query that I got it from a visual I have a visual that is built from a question and answer in power canvas but for that visual I don’t know to get the dax quarry so can you make one video that shows how to get this dax credit that makes this visual

    • @SQLBI
      @SQLBI  2 роки тому +1

      You can use the "All Queries" feature in DAX Studio. There is a full free video-course about DAX Studio here: www.sqlbi.com/p/dax-tools-video-course/