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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
POSPOS
Post Partisan
Post Partisan

Create calculated column with measure conditions using DAX

Hi all,

I have a sample data as below

POSPOS_0-1742579806423.png

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 24 = CALCULATE(COUNT('Sample data'[Employee Name]),'Sample data'[FY]="FY24")
Measure 2:
FY 25 = CALCULATE(COUNT('Sample data'[Employee Name]),'Sample data'[FY]="FY25")
Measure 3:
Indicator 24_25 = 
[FY 24]-[FY 25]

POSPOS_1-1742579931455.png

Now, I am trying to create a caluclated column in such a way that
if a employee has both FY 24 and FY 25 then show as "Both",
if only FY24 then show as "dropped from FY24"
if only FY 25 then "added in FY25".

 

I tried to create a cal column using the Measure 3 I created, but does not give expected results.

Can someone please help in providing a solution on how to achieve this using DAX.

 

Thank you

1 ACCEPTED SOLUTION
ArwaAldoud
Super User
Super User

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"
)

View solution in original post

3 REPLIES 3
POSPOS
Post Partisan
Post Partisan

@ArwaAldoud  - Thank you for providing this solution. It worked!

You're welcome @POSPOS  Glad to hear that it worked.

ArwaAldoud
Super User
Super User

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"
)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.