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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
shri0025
Helper II
Helper II

YTD VS LYTD as of Today

I have been struggling on what it is I am missing to compare last year sales data to this year sales data as of today.

when i am puting Measure on data card  LYTD show whole month i need Show data as of today now  and same issue  on MTD Data card Show Please hellp me .

 

 Result show as beloow LYTD = 71.54 as data card  and LY MTD SHow   0.14 as on 1 may 2022 as per my data

 

Please help me 

 

 

FYDayMonth YearTotal Sales
FY 21-22121-Apr0.22
FY 21-22221-Apr0.72
FY 21-22321-Apr0.48
FY 21-22421-Apr0.08
FY 21-22521-Apr1.40
FY 21-22621-Apr2.80
FY 21-22721-Apr2.26
FY 21-22821-Apr2.34
FY 21-22921-Apr2.22
FY 21-221021-Apr1.50
FY 21-221121-Apr0.28
FY 21-221221-Apr1.10
FY 21-221321-Apr3.18
FY 21-221421-Apr2.84
FY 21-221521-Apr1.80
FY 21-221621-Apr4.44
FY 21-221721-Apr5.32
FY 21-221821-Apr0.22
FY 21-221921-Apr2.60
FY 21-222021-Apr2.02
FY 21-222121-Apr2.04
FY 21-222221-Apr2.58
FY 21-222321-Apr1.72
FY 21-222421-Apr2.90
FY 21-222521-Apr0.64
FY 21-222621-Apr2.04
FY 21-222721-Apr2.88
FY 21-222821-Apr5.32
FY 21-222921-Apr8.08
FY 21-223021-Apr5.36
FY 21-22121-May0.14
FY 22-23122-Apr0.74
FY 22-23222-Apr0.14
FY 22-23322-Apr0.00
FY 22-23422-Apr0.28
FY 22-23522-Apr0.70
FY 22-23622-Apr1.00
FY 22-23722-Apr0.98
FY 22-23822-Apr1.10
FY 22-23922-Apr2.14
FY 22-231022-Apr0.00
FY 22-231122-Apr1.64
FY 22-231222-Apr2.02
FY 22-231322-Apr3.18
FY 22-231422-Apr3.06
FY 22-231522-Apr4.84
FY 22-231622-Apr3.36
FY 22-231722-Apr0.46
FY 22-231822-Apr3.58
FY 22-231922-Apr5.48
FY 22-232022-Apr5.60
FY 22-232122-Apr3.48
FY 22-232222-Apr3.30
FY 22-232322-Apr2.46
FY 22-232422-Apr1.02
FY 22-232522-Apr3.48
FY 22-232622-Apr3.34
FY 22-232722-Apr4.56
FY 22-232822-Apr6.14
FY 22-232922-Apr8.46
FY 22-233022-Apr13.12
FY 22-23122-May0.06
4 REPLIES 4
shri0025
Helper II
Helper II

Have been searching the forum for a while but without finding any answers to my questions:

 

1. I have created a MTD measure but this won't show any values if I don't have a date filter (= this month). 

    TotalMTD = TOTALMTD(SUM(PostedSalesInvoices[Amount]);dCalendar[Date])
 
2. I also want a LY MTD but this shows me the sales for the whole month previous year, not MTD.
   Totalt LMTD = CALCULATE ( [TotalMTD]; SAMEPERIODLASTYEAR( dCalendar[Date] ) )
 
shri0025
Helper II
Helper II

Hi please help  

 

i need MTD sales  LY mtd sales  Date wise  If  20 jun 22 MTD sales and LY mtd 20 Jun 

shri0025
Helper II
Helper II

Hi Not working 

v-yangliu-msft
Community Support
Community Support

Hi  @shri0025 ,

Here are the steps you can follow:

1. Create calculated table.

Date =
CALENDAR(DATE(2021,1,1),DATE(2022,12,31))

vyangliumsft_0-1655707388122.png

2. Create calculated column.

Year = VALUE("20"&""&LEFT('Table'[Month Year],2))
Month =
var _mon=RIGHT('Table'[Month Year],3)
return
CALCULATE(MAX('Date'[Month_number]),FILTER(ALL('Date'),'Date'[Month]=_mon))
Date_true =
DATE('Table'[Year],'Table'[Month],'Table'[Day])

3. Create measure.

LYTD =
CALCULATE(SUM('Table'[Total Sales]),FILTER(ALL('Table'),'Table'[Date_true]>=DATE(YEAR(TODAY())-1,1,1)&&'Table'[Date_true]<=EOMONTH(TODAY(),-12)))
LY MTD =
CALCULATE(MAX('Table'[Total Sales]),FILTER(ALL('Table'),'Table'[Date_true]>=DATE(YEAR(TODAY())-1,MONTH(TODAY())-1,1)&&'Table'[Date_true]<=EOMONTH(TODAY(),-13)))

4. Result:

vyangliumsft_1-1655707388125.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.