Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Issue is DAX formula

Hi Experts ,

I am new to Power BI.

My requirement is , I need to find out if Resolved date is after eg . 17/01/2020 then   Flag  should populate as  "Y" else "N".

Issue is there are records where resolved Date is blank then formula gives an error .

Could you please suggest .

 

Incident Number   Resolved date         Flag 

  1                             18/01/2020            Y

2                                15/01/2020           N

3                                                             N

4                                                             N

 

Regards,

Ganesh J

  • Hi,

    Try this calculated column formula

    =IF(Data[Resolved Date])>DATE(2020,1,17),"Y","N")

    Hope this helps.

2 Replies

  • dm-p's avatar
    dm-p
    Super User

    Hi Anonymous,

    I'm not sure if you want this as a column or a measure, but you just need to check the date is not BLANK before comparing it. The following should be enough to illustrate how to do this and apply to your situation:

    Flag =
    VAR ReferenceDate =
        DATE ( 2020, 1, 17 )
    RETURN
        IF (
            NOT ( ISBLANK ( 'Table'[Resolved Date] ) )
                && 'Table'[Resolved Date] > ReferenceDate,
            "Y",
            "N"
        )

    In this example, I'm not sure how you're sourcing the reference date so I have declared this as a variable up-top in case you are defining it using DAX and this will make it easier to maintain.

    Good luck!

    Daniel


    If my post solves your challenge, then please consider accepting as a solution to help other forum members find the answer more quickly 🙂

  • Hi,

    Try this calculated column formula

    =IF(Data[Resolved Date])>DATE(2020,1,17),"Y","N")

    Hope this helps.