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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ganesanr1002
Frequent Visitor

How to get sales value upto last month YTD same like previous Year YTD

Dear Floks, 

 

I m looking for the YTD Sales upto Last Month Example (Current Month is Jan . I need to show the YTD Sales from April 22 upto Dec 22  (Fiscal Year Start with April )). I did the measure using below formula 

YTD Upto Last Month 

var _start=DATE(year(TODAY()),month(TODAY()),1)
var _calc=CALCULATE('Measure'[Sales],'Dim Date'[Date]<_start)
return if(_calc>0,_calc,0)

same like that i m looking for Last Yr YTD Sales Upto Apr 21 to Dec 21 and i have slicer only for the fiscal year . I'm Getting not the result properly can any body helps. 

 

 

 

 

 

3 REPLIES 3
FreemanZ
Super User
Super User

Hi @ganesanr1002

try like:

Last Yr YTD = 
var _start= EDATE( DATE(year(TODAY()),month(TODAY()),1), -12)
var _calc=CALCULATE('Measure'[Sales],'Dim Date'[Date]<_start)
return if(_calc>0,_calc,0)

 

in case of issue, please consider providing sample dataset well reflecting your challenge. 

 

Greg_Deckler
Super User
Super User

@ganesanr1002 What does your date table look like?


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hey , Thanks for the response , 
Here is the script i m using for the dim date 
https://radacad.com/all-in-one-script-to-create-calendar-table-or-date-dimension-using-dax-in-power-...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors