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!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
How to write a dax query to get last 15 days data (15 days date range)?
i tried using this but its giving error.
Solved! Go to Solution.
pls try this
if [Due Date] >= Date.AddDays( Date.From(DateTime.LocalNow()),-15) and [Due Date] <= Date.From(DateTime.LocalNow()) then "15" else [Due Date]
pls try this
if [Due Date] >= Date.AddDays( Date.From(DateTime.LocalNow()),-15) and [Due Date] <= Date.From(DateTime.LocalNow()) then "15" else [Due Date]
In DAX you can use DATEADD for showing and interval, but in your case you would like to see last days from today?
I you want to do this, you can create a calendar table in DAX and agregate a calculate column for DAX. In this example shows last 15 days from today
Last15Days =
VAR DayOfToday =
TODAY()
VAR DateTable = 'Calendar Example'[Date]
VAR DAY15 = DayOfToday - 15
RETURN
IF(
DateTable >= DAY15
&& DateTable <= DayOfToday,
DateTable,
BLANK()
)
I hope this solution helps you