Forum Discussion

POSPOS's avatar
POSPOS
Post Partisan
1 year ago
Solved

Create calculated column with measure conditions using DAX

Hi all, I have a sample data as below Sample file is attaced here. I have created three measures, to highlight the employees who has only "FY 24"and only "FY 25" values. Measure 1 : FY 2...
  • ArwaAldoud's avatar
    1 year ago

    Hi POSPOS 

    try this 

    FY_Status =
    VAR HasFY24 = CALCULATE(COUNTROWS('Sample data'), 'Sample data'[FY] = "FY24", ALLEXCEPT('Sample data', 'Sample data'[Employee Name])) > 0
    VAR HasFY25 = CALCULATE(COUNTROWS('Sample data'), 'Sample data'[FY] = "FY25", ALLEXCEPT('Sample data', 'Sample data'[Employee Name])) > 0

    RETURN
    SWITCH(
    TRUE(),
    HasFY24 && HasFY25, "Both",
    HasFY24, "Dropped from FY24",
    HasFY25, "Added in FY25",
    "Unknown"
    )