cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ArchStanton
Post Patron
Post Patron

YTD amendment for last Financial Year

Hi,

 

My code below is now counting the no of incidents in the current FY just started (01/04/2023 - 31/03/2024)

 

How can amend the code below to give me the DistinctCount for 01/04/2022 - 31/03/2023?

 

 

YTD Closed = CALCULATE(
    TOTALYTD(DISTINCTCOUNT('Closed Cases'[incidentid]),
    'Closed Cases'[pre_resolutiondate],"31/03"),
    FILTER('Closed Cases', 'Closed Cases'[tpo_complexvuddycase] = FALSE()))

 

 

Thanks,

1 ACCEPTED SOLUTION
EdouardPBI
Frequent Visitor

hello, 

 

try this : calculate([YTD Closed],datesytd(calendar'date,-1,year))

 

sincerely

 

View solution in original post

4 REPLIES 4
Greg_Deckler
Super User
Super User

@ArchStanton Might be able to get there with PARALLELPERIOD but DAX's time intelligence functions aren't great with fiscal years. If you don't have any helper columns or anything, you could simply do this:

PYTD Closed = 
  VAR __Begin = DATE(2022,1,4)
  VAR __End = DATE(2023,3,31)
  VAR __Table = DISTINCT(SELECTCOLUMNS(FILTER('Closed Cases', [tpo_complexvuddycase] = FALSE() && [pre-resolutiondate] >= __Begin && [pre-resolutiondate] <= __End),"incidentid",[incidentid]))
  VAR __Result = COUNTROWS(__Table)
RETURN
  __Result

@ 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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Thanks,

I think I've got there with this but it always good to have alternatives, more than 1 way to skin a cat!

 

22/23 Closed = CALCULATE(
        DISTINCTCOUNT('Closed Cases'[incidentid]),
        DATESBETWEEN('Closed Cases'[pre_resolutiondate], "01/04/2022", "31/03/2023"),
        'Closed Cases'[tpo_complexvuddycase] = FALSE())
EdouardPBI
Frequent Visitor

hello, 

 

try this : calculate([YTD Closed],datesytd(calendar'date,-1,year))

 

sincerely

 

Thanks! much appreciated

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Top Solution Authors