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

View all the Fabric Data Days sessions on demand. View schedule

Reply
sm1driver
New Member

DAX dynamic measure, non standard calendar

Hi experts,

I only have a non-standard calendar dimension because the granularity is week level fact data.

sm1driver_0-1739408000012.png


I tried creating a Previous year measure using the following

RevenuePrevYear =
VAR CurrentYear = MAX('Calendar Fiscal'[FiscalYear])
VAR CurrentWeek = MAX('Calendar Fiscal'[FiscalWeek])
RETURN
CALCULATE(
_Measures[Revenue],
FILTER(
ALL('Calendar Fiscal'),
'Calendar Fiscal'[FiscalYear] = (CurrentYear - 1)&& --2024 minus 1 = 2023
'Calendar Fiscal'[FiscalWeek] = CurrentWeek- 100 --202452 minus 100 = 202352
)
)


This only seems to work when the rows are sliced by FiscalWeek. shows incorrect values when view by fiscal months

Is there a way for it to dynamically change when sliced by fiscal month or week and so on ?

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@sm1driver , Try using

 

DAX
RevenuePrevYear =
VAR CurrentYear = MAX('Calendar Fiscal'[FiscalYear])
VAR CurrentWeek = MAX('Calendar Fiscal'[FiscalWeek])
VAR CurrentMonth = MAX('Calendar Fiscal'[FiscalMonth])
RETURN
IF(
ISINSCOPE('Calendar Fiscal'[FiscalWeek]),
CALCULATE(
_Measures[Revenue],
FILTER(
ALL('Calendar Fiscal'),
'Calendar Fiscal'[FiscalYear] = (CurrentYear - 1) &&
'Calendar Fiscal'[FiscalWeek] = CurrentWeek
)
),
IF(
ISINSCOPE('Calendar Fiscal'[FiscalMonth]),
CALCULATE(
_Measures[Revenue],
FILTER(
ALL('Calendar Fiscal'),
'Calendar Fiscal'[FiscalYear] = (CurrentYear - 1) &&
'Calendar Fiscal'[FiscalMonth] = CurrentMonth
)
)
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

2 REPLIES 2
bhanu_gautam
Super User
Super User

@sm1driver , Try using

 

DAX
RevenuePrevYear =
VAR CurrentYear = MAX('Calendar Fiscal'[FiscalYear])
VAR CurrentWeek = MAX('Calendar Fiscal'[FiscalWeek])
VAR CurrentMonth = MAX('Calendar Fiscal'[FiscalMonth])
RETURN
IF(
ISINSCOPE('Calendar Fiscal'[FiscalWeek]),
CALCULATE(
_Measures[Revenue],
FILTER(
ALL('Calendar Fiscal'),
'Calendar Fiscal'[FiscalYear] = (CurrentYear - 1) &&
'Calendar Fiscal'[FiscalWeek] = CurrentWeek
)
),
IF(
ISINSCOPE('Calendar Fiscal'[FiscalMonth]),
CALCULATE(
_Measures[Revenue],
FILTER(
ALL('Calendar Fiscal'),
'Calendar Fiscal'[FiscalYear] = (CurrentYear - 1) &&
'Calendar Fiscal'[FiscalMonth] = CurrentMonth
)
)
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Magic! 
didn't know of ISINSCOPE keyword. 
awesome. 
obviously added the -100 in the filter for the previous year in weeks and months and it worked beautiful. appreciate it, thank you!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.