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

How to calculate LYTD and CYTD without having a date filter in report page?

I want to calculate last year ytd and current year ytd, without using a calender date table in my report page view, now my FY starts every year from April and ends on March, so my LYTD is April 2019 - Feb 2020. and my CYTD is April 2020 - Feb 2021, am not taking current month till date in my ytd scenerios, now I have build below for the above logic, this is as per CYTD:

 

CY Year = VAR EndDate =
DATE(YEAR( TODAY()),MONTH(TODAY())-1,31)
VAR StartDate =
DATE(YEAR( TODAY())-1,4,1)
var _b=
CALCULATE (
SUM('FWS Report for National'[Billing Qty]),
CALCULATETABLE (
'FWS Report for National',
FILTER (
'FWS Report for National',
'FWS Report for National'[Calendar Day.Calendar Day Level 01.Key]>= StartDate
&& 'FWS Report for National'[Calendar Day.Calendar Day Level 01.Key]<= EndDate
)
)
)
Return
_b/1000
 
but it gives me incorrect result because am specifying DATE(YEAR( TODAY()),MONTH(TODAY())-1,31) and in case of februrary this gives me March 3 2021 till date calculation which is incorrect, how can I build more robust formula which will only take current month -1 and does not go about specifiying dates here???

 

 

1 ACCEPTED SOLUTION
Anmolgan
Post Prodigy
Post Prodigy

I think I figured this out using EOMONTH DAX thanks for the help

View solution in original post

1 REPLY 1
Anmolgan
Post Prodigy
Post Prodigy

I think I figured this out using EOMONTH DAX thanks for the help

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.