Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!View all the Fabric Data Days sessions on demand. View schedule
Hello - I am trying to create a measure that will be used in a trailing 12 months bar chart where the left-most bar in the chart is the the oldest date and the farthest right bar is the current month. to create this I made the below measure where I am filtering the sum of my total sales by those in the last 12 months. To do this I created a disconnected date table named 'date' both the [End of Month Date] columns are formatted as "date" types and have been automatically turned into a date heirarchy by Power BI. The measure does not display an error until I add it to my visual where it says: "Dax comparison operations do not support comparing values of type date with values of type text. Consider using the VALUE or FORMAT function to convert one of the values."
I tried adding the .[Date] to the end of the [End of Month Date] fields in the measure and it did not work either. Do I need to convert all the dates to text for some reason? Thank you!!
Solved! Go to Solution.
@Anonymous
Try this one, please. you have to add two &&
TTM_Sales =
VAR CurrentDate =
MAX ( 'Date'[End of Month Date] )
VAR previousdate = CurrentDate - 365
RETURN
CALCULATE (
SUM ( 'Shipment Query'[Total Revenue] ),
FILTER (
'Shipment Query',
'Shipment Query'[End of Month Date] >= previousdate &&
'Shipment Query'[End of Month Date] <= CurrentDate
)
)
You can use one of the Time Intelligence functions like:
CALCULATE (
[Sales Amount],
DATESINPERIOD (
'Date'[Date],
MAX ( 'Date'[Date] ),
-1,
YEAR
)
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@Anonymous
Try this one, please. you have to add two &&
TTM_Sales =
VAR CurrentDate =
MAX ( 'Date'[End of Month Date] )
VAR previousdate = CurrentDate - 365
RETURN
CALCULATE (
SUM ( 'Shipment Query'[Total Revenue] ),
FILTER (
'Shipment Query',
'Shipment Query'[End of Month Date] >= previousdate &&
'Shipment Query'[End of Month Date] <= CurrentDate
)
)
You can use one of the Time Intelligence functions like:
CALCULATE (
[Sales Amount],
DATESINPERIOD (
'Date'[Date],
MAX ( 'Date'[Date] ),
-1,
YEAR
)
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
That fixed it! Thank you for the quick and helpful response!!!
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!