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
jdw_msft
Frequent Visitor

Get MTD/YTD from only last date of the month and add to total MTD/YTD if the current is not finished

Hello everyone, i have data source that come like this:

month januarymonth januarymonth marchmonth marchmonth februarymonth februarymonth aprilmonth april

the visual slicerthe visual slicer

 

 

 

 

 

mtdmtdytdytd

 

I want to get MTD only from last date of the month (from sales_running_sum column, i.e. 31/01/2024 is 104, etc.) or latest date from current month/current year and also sum YTD from MTD. And if the the month is not finished it'll be added to running MTD and YTD too. And also the slicer is divided into three sections (date, month, and year)

 

Is there any solution that can i implement it?

 

 

 

1 ACCEPTED SOLUTION
Selva-Salimi
Super User
Super User

Hi @jdw_msft ,

 

you can write the measures like:

 

MTD := calculate(sum(sales_running_sum), filter(table, date=max(date)))

and

YTD := var tbl1=summarize(table, year(date),month(date), "mtd",maxx(filter(table,date=max(date)),sales_running_sum));

             retrun sumx(tbl1,mtd)

 

If this post helps, then I would appreciate a thumbs up  and mark it as the solution to help the other members find it more quickly. 

View solution in original post

2 REPLIES 2
Selva-Salimi
Super User
Super User

Hi @jdw_msft ,

 

you can write the measures like:

 

MTD := calculate(sum(sales_running_sum), filter(table, date=max(date)))

and

YTD := var tbl1=summarize(table, year(date),month(date), "mtd",maxx(filter(table,date=max(date)),sales_running_sum));

             retrun sumx(tbl1,mtd)

 

If this post helps, then I would appreciate a thumbs up  and mark it as the solution to help the other members find it more quickly. 

I try to implement it and it doesn't work like i'm expected.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.