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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Defining Dates for CALCULATE using a parameter and DATESMTD

Metric Current Period = SWITCH('Period Selection'[Period Type Selected],
    1, CALCULATE(Transactions[Metric],
        DATESMTD(
        {
        [AsAtDate]
        })
    )
)
Error: Cannot find table ".

 

For the purposes of monthly reporting, I'm trying to define a range of dates to calculate a metric over. The visual will then show a single total for only that period selected. AsAtDate is a measure corresponding to the last day that the report is being made for. I think it's a problem with the way the Column/Single Column Table is being defined?

 

Can I use a Measure in this way?

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

@Anonymous Probably not, measures can't return tables and DATESMTD wants a table of dates.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler 

Ok to a switched to filters in series for the date table and new measures AsAtYear, AsAtMonth, AsAtQuarter so they only need to be calculated once with data refresh.  I've got to wonder if there is a better way to do it that jumps out at you, considering I'm leaping sideways from my expectation that I could create a table from a measure, and still casting off the assumptions I had.

 

Thanks for your reply as well.

Greg_Deckler
Community Champion
Community Champion

@Anonymous Tought to say, not sure I have enough context about the data and what you are doing. But I would love it if measures could return tables. Would really help cut down on repeating the same code in multiple places. 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Users online (27)