cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Brianoreilly Regular Visitor
Regular Visitor

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
Community Support Team
Community Support Team

Re: Calculated Column: If Statement with Date Slicer

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
Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Power BI Helps Homeless and Trouble Youth

Power BI Helps Homeless and Trouble Youth

We spoke with Power BI Super User, Greg Deckler, about his charity work

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 353 members 3,585 guests
Please welcome our newest community members: