Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Help with DAX formula in a created table to do MTD/QTD/YTD filter

I have used this table in several projects and haven't had any troubles before. But i tried to use it today and it doesn't work anymore. 

 

MTD/QTD/YTD =
VAR TodayDate = TODAY()
VAR YearStart = CALCULATE(STARTOFYEAR(Query1[Fecha]), YEAR(Query1[Fecha]) = YEAR(TodayDate))
VAR QuarterStart = CALCULATE(STARTOFQUARTER(Query1[Fecha]), YEAR(Query1[Fecha]) = YEAR(TodayDate), QUARTER(Query1[Fecha]) = QUARTER(TodayDate))
VAR MonthStart = CALCULATE(STARTOFMONTH(Query1[Fecha]), YEAR(Query1[Fecha]) = YEAR(TodayDate), MONTH(TodayDate) = MONTH(TodayDate))
VAR Result =
UNION(
ADDCOLUMNS(
CALENDAR(YearStart, TodayDate),
"Selection", "YTD"
),
ADDCOLUMNS(
CALENDAR(QuarterStart, TodayDate),
"Selection", "QTD"
),
ADDCOLUMNS(
CALENDAR(MonthStart, TodayDate),
"Selection", "MTD"
)
)
RETURN
ResultCaptura de pantalla (56).png
2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous,

Did PaulDBrown 's suggestions help with your scenario? if that is the case, you can consider Kudo or accept his suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

PaulDBrown
Community Champion
Community Champion

Try using FILTER and the && in the VAR expressions. For example

VAR QuarterStart = CALCULATE(STARTOFQUARTER(Query1[Fecha]), FILTER(Query1, YEAR(Query1[Fecha]) = YEAR(TodayDate) && QUARTER(Query1[Fecha]) = QUARTER(TodayDate)))





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.