Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
I am trying to create a simple moving average for my area chart and I keep getting the following error. "A column specified in the call to function 'datesbetween' is not of type date. this is not supported."
Here is my function
Solved! Go to Solution.
Hi @Anonymous ,
I suggest you to create a DimDate table with continuous date if you want to use DATESBETWEEN() which is a time intelligence function.
Try CALENDAR() or CALENDARAUTO().
DimDate = ADDCOLUMNS( CALENDARAUTO(),"Year",YEAR([Date]),"Month",MONTH([Date]))
My Sample:
Measure:
Measure =
AVERAGEX(
DATESBETWEEN(DimDate[Date],MIN(DimDate[Date]),MAX(DimDate[Date])),
CALCULATE(sum('Data (10)'[Count]))
)
Then add Year/Month columns into Axis. Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello, that still didn't work. I did not get an error in DAX but when I input the measure in my chart it did not add a simple moving average (SMA).
Hi @Anonymous ,
I suggest you to create a DimDate table with continuous date if you want to use DATESBETWEEN() which is a time intelligence function.
Try CALENDAR() or CALENDARAUTO().
DimDate = ADDCOLUMNS( CALENDARAUTO(),"Year",YEAR([Date]),"Month",MONTH([Date]))
My Sample:
Measure:
Measure =
AVERAGEX(
DATESBETWEEN(DimDate[Date],MIN(DimDate[Date]),MAX(DimDate[Date])),
CALCULATE(sum('Data (10)'[Count]))
)
Then add Year/Month columns into Axis. Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous , Make sure the data type is date, why both are max
always use date table
try like
CALCULATE
( AVERAGEX(values('Data (10)'[RequestDateRaised - Copy]),
CALCULATE(sum('Data (10)'[Count]))
),DATESBETWEEN('Date'[Date],min('Date'[Date]),max('Date'[Date])))
Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5bd4
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 53 | |
| 35 | |
| 31 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 75 | |
| 72 | |
| 39 | |
| 35 | |
| 23 |