Forum Discussion

Help_me's avatar
Help_me
Frequent Visitor
5 months ago
Solved

How to write this IF statement for same date, but different statuses?

Hello, I have the two columns below in the same table. "Cookie Type" is text field and "Baked_Date" is a date value. How can I write the IF statement in DAX for the concept: If the same baked_date ...
  • Kedar_Pande's avatar
    5 months ago

    Help_me 

     

    Calculated column:

    Eat Flag = 
    VAR CurrentDate = 'Table'[Baked_Date]
    RETURN
    IF(
    CALCULATE(
    COUNTROWS('Table'),
    'Table'[Baked_Date] = CurrentDate,
    'Table'[Cookie Type] IN {"Chewy", "Chunky"}
    ) = 2,
    "Eat",
    "Do not eat"
    )

    Checks if both Chewy + Chunky exist on same Baked_Date.