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!
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?
EDATE is faster, DATEADD and LASTDATE are table functions, but DATESBETWEEN need scalar values, so you are introducing unnecessary conversions along the line.
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]
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
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 ?
Can I use it for weeks compurgation, same WEEKNUMBER last year?
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!
Look at the DAX Patterns for week-related calculations: www.daxpatterns.com/week-related-calculations/
0:29- SAMEPERIODLASTYEAR
1:14- DATEADD
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?
EDATE is faster, DATEADD and LASTDATE are table functions, but DATESBETWEEN need scalar values, so you are introducing unnecessary conversions along the line.
@@SQLBI Thanks for the response, it struck me as a method that, even though it worked could have problems. I shall stick to EDATE.
Thank you!
Thank you
I am getting circular dependency issue with it
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]
Check this article/video: www.sqlbi.com/articles/solving-errors-in-calculate-filter-arguments/
@@SQLBI Thank you, excellent explanation, I love this channel because they always touch advanced topics explained in a simple way.
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
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/