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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Brianoreilly
Helper II
Helper II

Calculated Column: If Statement with Date Slicer

Hi Folks, 

 

I have 3 tables: 

1: Timecard Table

2: Date Table 

3: Contact Table. 

 

I am hoping to build a Calculated Column (not a measure). 

 

The logic I require is if the: Resources Start Date and End Date are blank  then pull the minimum date selected in the date table slicer. 

It is currently pulling the minimum date in the entire table.

 

Any help appreciated.

 

Issue with the code in red. How can I get to slicer value instead of the table minimum value.

 

 

Test = 
VAR startdate =
    
        CALCULATE (
            VALUES ( Contact[Start Date] ),
            FILTER ( Contact, Contact[Id] = 'Timecard Split'[Resource ID] )
        )
    

VAR enddate =
    
        CALCULATE (
            VALUES(Contact[Start Date]),
            FILTER ( Contact, Contact[Id] = 'Timecard Split'[Resource ID] )
        )
    

RETURN
    (IF(And(ISBLANK(startdate),ISBLANK(enddate)),[Minimum Date],startdate))

 date issue.JPG

1 REPLY 1
v-lili6-msft
Community Support
Community Support

hi, @Brianoreilly

You said "I am hoping to build a Calculated Column (not a measure)."

 calculated columns and calculated  tables are not affected by any slicer.

https://community.powerbi.com/t5/Desktop/New-table-with-measures-values/td-p/189124

 

 calculated columns and calculated  tables are only "computed during database processing(e.g. data refresh) and then stored in the model, they do not response to user selections on the report(like a Slicer)."

 

So if you want the slicer can affect the values, you need to build a Calculated measure (not a column).

 

Best Regards,

Lin

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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