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
cristianml
Post Prodigy
Post Prodigy

Calculate YTD - Dates between FirstFiscalMonth and last month

Hi,

I need help to calculate my measures between Sep-18 and last month (as YTD) . .  I have the following meaure but the problem is that I need to show in same dashboard two things : 

YTD Amounts = September'18 to March'19

FY19 Amounts = September'18 to August'19

 

I have this measure and use relative date to show me the YTD but for FY19 it limits me to YTD by using relative date in the Slicer :

 

YTD Actual Cost =
CALCULATE (
[Actual Costs],
VAR FirstFiscalMonth = 9 -- Set the first month of the fiscal year
VAR LastDay =
MAX ( 'List Period'[Date Period] )
VAR LastMonth =
MONTH ( LastDay )
VAR LastYear =
YEAR ( LastDay )
- IF ( LastMonth < FirstFiscalMonth, 1 )
VAR FilterYtd =
DATESBETWEEN (
'List Period'[Date Period],
DATE ( LastYear, FirstFiscalMonth, 1 ),
LastDay
)
RETURN
FilterYtd
 
 
I need if possible a Dax formula that not depends of the date filtered in Slicer ..  I tried to combine these two parameters but I didn't find the logic yet : 
 
YTD Actual Cost = CALCULATE ([Actual Costs], VAR FirstFiscalMonth = 9   +  VAR LastDay = MAX ( EOMONTH(today(),-1) )
 
Any ideas ?
 
Thanks !
 
 
 
 
 
 
 

 

 

 

2 REPLIES 2
v-danhe-msft
Employee
Employee

Hi @cristianml ,

What is your desired result for your formula:

YTD Actual Cost = CALCULATE ([Actual Costs], VAR FirstFiscalMonth = 9   +  VAR LastDay = MAX ( EOMONTH(today(),-1) )

I could not understand if your formula shoud not depend on a slicer, could you please offer your sample pbix file and post your desired result that I could test for you?

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-danhe-msft ,

 

Bassically I need a dax formula that can calculate from a specific month  (in my case/example I put 9 to refer to September'18) to last month (in this example March'19) 

 

Thanks & regards. 

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.