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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
Camill88
Frequent Visitor

Year extracted from date picker can't be compared to year from DateTable

I have some easy task to do - I want to filter Date table based on year taken from date picker. Here are my measures:

 

1. Measure which extracts year from date picker

 

 

Selected Date = 
CALCULATE(
   YEAR(MAX( DateTable[Date] )),
   ALLSELECTED( DateTable[Date] )
)

 

 

2. Calculated table where I use above measure to filter Date table

 

 

VAR vSelectedDate = [Selected Date]

VAR vCustomersNotInYear =
CALCULATETABLE(
    VALUES('DateTable'[Year]),
    'DateTable'[Year] < vSelectedDate
    )
    
RETURN vCustomersNotInYear

 

 

I checked, that measure [Selected Date] returns year properly, it's a number. Year in Date table is also a number. When I change date on a picker then Calculated table doesn' react. However, when I assign years manullay e.g.:

 

 

'DateTable'[Year] = 2010

 

 

then it works fine. I also tried to explicitly enforce converting measure to number (just in case): 

 

 

VAR vSelectedDate = VALUE([Selected Date])

 

 

but it also doesn't help. Where the problem lies? 

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @Camill88 ,

 

You can reference a measure in a calculated table. But calculated table/column are not supposed to respond to the slicer actions(even any visual actions). That is the only reason behind. 

View solution in original post

2 REPLIES 2
FreemanZ
Super User
Super User

hi @Camill88 ,

 

You can reference a measure in a calculated table. But calculated table/column are not supposed to respond to the slicer actions(even any visual actions). That is the only reason behind. 

Ok, thanks. So what should I do in this case? Add calculated table to modela and establish relationship to fact table? What's the good practice here?

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors
Top Kudoed Authors