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!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
Hi,
I'm trying to make sure that when I filter the month, the table returns the 5 months before that filtered month.
I'm new to dax language and I don't have so much advanced knowledge and I found a way to solve this link:
https://towardsdatascience.com/override-date-filter-in-power-bi-743b9e8b9b2
What I did was create this measure
Value of docs -5 month = VAR MaxDate = MAX (Date [Date])
VAR MinDate = DATE (YEAR (MaxDate), MONTH (MaxDate) -5, DAY (MaxDate))
VAR Result = CALCULATE (
DISTINCTCOUNT (Table [DOC_ID]),
FILTER (table,
table [Date]> = MinDate && table [Date] <= MaxDate)
)
RETURN
Result
the table [data] is the main date of my data table
and the date [date] is a table just like the date, as if it were a fatto table
You are returning the last 5 months regarding the maximum date not what was filtered, how would you do this measure to solve this?
try changing the filter in your return to this
FILTER ( all(table) ,Table [Date]> = MinDate && table [Date] <= MaxDate)
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.
User | Count |
---|---|
9 | |
8 | |
6 | |
4 | |
3 |