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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Measure for if statement does not work when using time series

Hi there,

 

I would like some help please. I have the following sample financial data for the years 2019, 2020, 2021. Note that I have a Date Dimension table in my model already, I put the below as reference for the data.

 

Fareed86_0-1611134235089.png

 

I have SUM measures for the Actual, Budget and Estimates columns currently. I'm creating an additional measure for the following logic:

Actual_Expense_Budget =
IF(
     ALLSELECTED(DimDate[Year]) < YEAR(TODAY()),
     [Monthly (Actuals)],
     IF(
         ALLSELECTED(DimDate[Year]) = YEAR(TODAY()),
         [Monthly Estimates],
         [Monthly Budgets]
      )
  )
 
This gives me the correct result when filtering between years (I have a Year filter on my page).
 
However I get the following error when adding the measure to a chart with YEAR as an axis from my DimDate table:
 
 
 

capture-.PNG

 

 

 

 

 

 

 

 

Any help would be really appreciated. Thank you

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , You can have measure like this

Actual_Expense_Budget =
IF(
Max(DimDate[Year]) < YEAR(TODAY()),
[Monthly (Actuals)],
IF(
Max(DimDate[Year]) = YEAR(TODAY()),
[Monthly Estimates],
[Monthly Budgets]
)
)

 

But this will check row context

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , You can have measure like this

Actual_Expense_Budget =
IF(
Max(DimDate[Year]) < YEAR(TODAY()),
[Monthly (Actuals)],
IF(
Max(DimDate[Year]) = YEAR(TODAY()),
[Monthly Estimates],
[Monthly Budgets]
)
)

 

But this will check row context

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Great, thank you so much. I didn't realise it could have been that simple!

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors