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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
akankshamohanty
Regular Visitor

LTM not calculating previous year data

My requirement is to show YTD till December2022 and LTM from Jan 2023.I have written this dax code.But the issue is the filter condition in the first if line ie the current year .
for LTM jan 2023=its calculating only jan 2023 and for  LTM feb 2023  its calculating (jan+feb) 2023.Not going back to 2022 .
what changes should i make to the dax.
 
 
 
TEST Z =
var filled_total = IF(MAX('GBLDEVALLDW DateDim'[CalendarDate])=YEAR(TODAY()),
                       CALCULATE( COUNT( PageUp[FilledDate] ),PageUp[Jobstatus]="Filled",
                                     DATESINPERIOD('GBLDEVALLDW DateDim'[CalendarDate],
                                        MAX('GBLDEVALLDW DateDim'[CalendarDate]),
                                         -12,
                                          MONTH))
                                        ,
                          CALCULATE( COUNT( PageUp[FilledDate] ),PageUp[Jobstatus]="Filled",
                          DATESYTD('GBLDEVALLDW DateDim'[CalendarDate])))                            
                                                 
var filled_internal =IF(MAX('GBLDEVALLDW DateDim'[CalendarDate])=YEAR(TODAY()),
                           CALCULATE( COUNT( PageUp[FilledDate]),PageUp[Jobstatus]="Filled" ,
                            PageUp[IsInternalApplicant]="Yes",
                                  DATESINPERIOD('GBLDEVALLDW DateDim'[CalendarDate],
                                       MAX('GBLDEVALLDW DateDim'[CalendarDate]),
                                            -12,
                                               MONTH)) ,
                          CALCULATE( COUNT( PageUp[FilledDate]),PageUp[Jobstatus]="Filled" , PageUp     [IsInternalApplicant]="Yes",
                DATESYTD('GBLDEVALLDW DateDim'[CalendarDate])))
 return
IF( filled_internal=BLANK(), 0 ,filled_internal/filled_total)
0 REPLIES 0

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.