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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
AntonL
Regular Visitor

ssas dax tabular MTD last child

hello

need help with mtd

factTable[move_usd]

dimDate[DateID]

 

move_total:=CALCULATE(sum(factTable[move_usd]),DATESMTD(dimDate[DateID]))

it works, but my calendar is greater than today and fact data is before today

so it calculates unit EOF calendar

 

i added:

move_total_2:=IF(lastdate(dimDate[DateID]) >= Today(), Blank()
,CALCULATE(sum(factTable[move_usd]),DATESMTD('dimDate'[DateID])))

 

but if month is not closed on month/year level it shows empty value

 

how to:

1. calculate MTD

2. until today

3. with last child(not greater than yeasterday) on month/year level

 

before i used MDX,'mosha formula' , now i'm re-writing on tabular

in mdx i used MTD + scope

how i can handle it in dax?

 

thank you.

 

2 REPLIES 2
lbendlin
Super User
Super User

Have you considered using DATESMTD ? 

oh, sorry i made a mistake in my request

yes of course i'm using DATESMTD (in original request i wrote YTD)

 

but the question is about next

on screenshot two measures:

 

MTD_v2:=
CALCULATE(
sum(fact_Table[move_usd]),
DATESMTD('dim_Date'[DateID]))

 

 

MTD_v1:=
IF(
ISINSCOPE(dim_Time[DateID]),
if(
MAX(dim_Time[DateID]) >= Today(),
Blank(),
MTD_v2
)
, inv_mtd)



so the issue is 

1.

for mtd_v1 - on february 2023 level and on 1Q and 2023 - empty, but 26th feb(lastFactDate) is needed

so i need value from last fact date on month,q, year level

2.

fir mtd_v2 - values should be empty for days after 26th feb 

 

 

AntonL_1-1677488157749.png

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI 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.