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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
cerebro
Frequent Visitor

Calculate and show YTD values month by month with fiscal year unequal calendar year

Dear everybody,

 

our business year starts in April.

I am trying to show ytd revenues every month sorted by product and source with this formula

QTY YTD = CALCULATE ((TOTALYTD(SUM('Sales'[ QTY]), 'Sales'[Date].[Date], ALLEXCEPT ( 'Sales', 'Sales'[Source], 'Sales'[Product]))))

Where do i insert the stop date of 31.03 to prevent the formula from counting after the 31st of March?

Please see my project file with sample data under the following link

Onedrive Link 

thank you in advance

 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@cerebro , Use a date table joined with date of you table and create measure like example

 

 

example

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))

YTD =
var _max = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _min = eomonth(_max,-1*MONTH(_max))+1
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))

 

Time Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s

 

 

You can also consider the window function

Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc

 

 

 

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@cerebro , Use a date table joined with date of you table and create measure like example

 

 

example

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))

YTD =
var _max = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _min = eomonth(_max,-1*MONTH(_max))+1
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))

 

Time Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s

 

 

You can also consider the window function

Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc

 

 

 

thanks a lot. i implemented your solution and it worked.

will power bi always need this special "date table" to work with measures that require date intervalls?

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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