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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
JustinRobinette
New Member

Conditional Column if Identifier ever has a value in specific column

I have a table with multiple rows for each identifier. I want to add a conditional column if the identifier ever has a specific value in another column. In the below example, because FIN 234 contains Observation on one row, I want all rows of that FIN to include 'Observation'.

 

FIN          Census Event          Encounter Type          Proposed New Column
123          Admission                Emergency

123          Discharge                 Emergency

234          Admission                Emergency                        Observation

234          Transfer In                Observation                      Observation

234          Discharge                 Observation                      Observation

345          Admission                OP Surgery

345          Discharge                 OP Surgery

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

This calculated column formula works

=if(CALCULATE(COUNTROWS(Data),FILTER(Data,Data[FIN]=EARLIER(Data[FIN])&&Data[Encounter Type]="Observation"))>0,"Observation",Blank())

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

1 REPLY 1
Ashish_Mathur
Super User
Super User

Hi,

This calculated column formula works

=if(CALCULATE(COUNTROWS(Data),FILTER(Data,Data[FIN]=EARLIER(Data[FIN])&&Data[Encounter Type]="Observation"))>0,"Observation",Blank())

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.