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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Jaime_FOS
Regular Visitor

Lookup value based on isfiltered

Hi,

 

I have a table listing in my report that shows a person's name and their status e.g. 'working', homeworking' or 'out of office'. I'm using a lookupvalue to return this status - LOOKUPVALUE(ABSENCE_DATA[Employee Status],ABSENCE_DATA[EmployeeID],'CrossJoin Table 1'[EmployeeID],ABSENCE_DATA[startdate].[Date],'CrossJoin Table 1'[CAL_DATE],"Working").

 

What I'm trying to do is create a measure whereby if a date is selcted via a slicer, then return the status for that particular date. If no date is selected, then default to today's status. I've been using isfiltered for my calculated measures, as I can apply a date filter in the dax. However, I'm not able to do this with a lookupvalue. Is there a workaround, or is there another way that I can get the same result as the lookupvalue, and apply a filter within the measure?

 

Thanks in advance!

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hi @Jaime_FOS 

try a measure like

Measure = 
var SelectedDate = IF(ISFILTERED('CrossJoin Table 1'[CAL_DATE]), SELECTEDVALUE('CrossJoin Table 1'[CAL_DATE]), TODAY())
var CurrentEmployee = MAX('CrossJoin Table 1'[EmployeeID])
var Result = CALCULATE(MAX(ABSENCE_DATA[Employee Status]), ABSENCE_DATA[startdate].[Date] = SelectedDate, ABSENCE_DATA[EmployeeID] = CurrentEmployee )
RETURN
COALESCE(Result,"Working")

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

3 REPLIES 3
v-lionel-msft
Community Support
Community Support

Hi @Jaime_FOS ,

 

You may need to do like this.

1. Create a calculated column in 'CrossJoin Table'.

 

Column = 
LOOKUPVALUE(
    ABSENCE_DATA[Employee Status],
    ABSENCE_DATA[EmployeeID], 'CrossJoin Table'[EmployeeID],
    ABSENCE_DATA[startdate], 'CrossJoin Table'[CAL_DATE],
    ABSENCE_DATA[Employee Status], "Working"
)

 

2. Create a measure.

 

Measure = 
IF(
    ISFILTERED('CrossJoin Table'[CAL_DATE]),
    SELECTEDVALUE('CrossJoin Table'[Column]),
    CALCULATE(
        MAX('CrossJoin Table'[Column]),
        FILTER( ALL('CrossJoin Table'), 'CrossJoin Table'[CAL_DATE] = TODAY() )
    )
)

 

2.PNGv-lionel-msft_0-1595920591757.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

az38
Community Champion
Community Champion

Hi @Jaime_FOS 

try a measure like

Measure = 
var SelectedDate = IF(ISFILTERED('CrossJoin Table 1'[CAL_DATE]), SELECTEDVALUE('CrossJoin Table 1'[CAL_DATE]), TODAY())
var CurrentEmployee = MAX('CrossJoin Table 1'[EmployeeID])
var Result = CALCULATE(MAX(ABSENCE_DATA[Employee Status]), ABSENCE_DATA[startdate].[Date] = SelectedDate, ABSENCE_DATA[EmployeeID] = CurrentEmployee )
RETURN
COALESCE(Result,"Working")

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

This worked perfect! Thanks 🙂

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.