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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
nerra
Helper II
Helper II

YTD, MTD, WTD Unable to calculate

Hello All!

 

I'm a bit stuck with calculating the YTD , MTD and WTD measures for Sales.

Currently my Calendar table is set up like this:

 

image.png

 

I have calulated columns for Fiscal Period/Year/Week  Start/End dates.

 

I've tried the following for Month To Date:

MTD Sales CY 2 =  CALCULATE([Total Net Sales] , FILTER(ALL(BusinessDate) , BusinessDate[Fiscal Period Start Date]>=BusinessDate[Fiscal Period Start Date] && BusinessDate[Business Date]<=MAX(BusinessDate[Business Date])))
 This returns cummulatie value, but the total is for all periods ever. 
 
MTD Sales CY 4 = CALCULATE([Total Net Sales],
FILTER(BusinessDate, BusinessDate[Business Date]>=BusinessDate[Fiscal Period Start Date] && BusinessDate[Business Date]<=MAX(BusinessDate[Business Date]))) 
returns the total for the entire month instead of month to date.
 
I'm circuling in loops and can't get out. 
 
 
 

 

 

1 ACCEPTED SOLUTION

Actualy, that would not take into account Fiscal month/week/year.

Looks like

MTDSales CY = CALCULATE (
[Total Net Sales],
FILTER (
ALL( BusinessDate ),
BusinessDate[Fiscal Year]= MAX (BusinessDate[Fiscal Year])
&& BusinessDate[Fiscal Period] = MAX ( BusinessDate[Fiscal Period])
&& BusinessDate[Business Date] <= MAX ( BusinessDate[Business Date] )
))
 
is the solution. Thanks!

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

For ytd and MTD , prefer date intelligence function datesmtd, totalmtd, datesytd and totalytd. ytd can take year and date

 

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last MTD (complete) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH))))
last year MTD (complete) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-12,MONTH))))

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date]),"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
Last YTD complete Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Connect on Linkedin

Actualy, that would not take into account Fiscal month/week/year.

Looks like

MTDSales CY = CALCULATE (
[Total Net Sales],
FILTER (
ALL( BusinessDate ),
BusinessDate[Fiscal Year]= MAX (BusinessDate[Fiscal Year])
&& BusinessDate[Fiscal Period] = MAX ( BusinessDate[Fiscal Period])
&& BusinessDate[Business Date] <= MAX ( BusinessDate[Business Date] )
))
 
is the solution. Thanks!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.