Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
The intention is to create a new column (Desired_Column) indicating whether a patient (Patient_ID) that completed a New Consult continued onto a Procedure.
Date | Patient_ID | Visit_Type | Desired_Column |
1/3/23 | 187 | New Consult | Yes |
1/5/23 | 039 | Procedure | |
1/7/23 | 188 | New Consult | Yes |
1/10/23 | 187 | Procedure | |
1/16/23 | 098 | Procedure | |
1/20/23 | 189 | New Consult | No |
1/23/23 | 188 | Procedure | |
1/25/23 | 102 | Procedure | |
1/25/23 | 190 | New Consult | No |
I am rather new to using Power BI and am struggling on formulating a way to indicate whether Patient_ID still exists after Visit_Type is filtered to show "Procedure".
Thanks in advance.
Solved! Go to Solution.
@db400 here it is , small tweak, when I tested at my end the date data type was text and that was the issue:
Column =
VAR __Patient = Patient[Patient_ID]
VAR __Date = Patient[Date]
VAR __Table =
FILTER ( ALLSELECTED ( Patient ), [Patient_ID] = __Patient && Patient[Date] >= __Date && Patient[Visit_Type] <> "NPC" )
RETURN
IF ( Patient[Visit_Type] = "NPC" , IF ( NOT ISEMPTY ( __Table ), "Yes", "No" ) )
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@db400 here it is , small tweak, when I tested at my end the date data type was text and that was the issue:
Column =
VAR __Patient = Patient[Patient_ID]
VAR __Date = Patient[Date]
VAR __Table =
FILTER ( ALLSELECTED ( Patient ), [Patient_ID] = __Patient && Patient[Date] >= __Date && Patient[Visit_Type] <> "NPC" )
RETURN
IF ( Patient[Visit_Type] = "NPC" , IF ( NOT ISEMPTY ( __Table ), "Yes", "No" ) )
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
It works flawlessly. Thank you so much!!
@db400 I have no clue, you need to share the pbix file
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Here is the link to the .pbix file:
https://drive.google.com/file/d/15AQVNauOH9BxvKMGkk7QKjmEhy7Jo909/view?usp=sharing
@db400 not sure why, can you make sure there are invisible spaces with "New Consult" values?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
I adjusted the table and formula to show "NPC" instead of "New Consult" instead to avoid any issues with invisible spacing and it still doesn't fix the issue.
@db400 try using this DAX to add a calculated column:
Column =
VAR __Patient = Patient[Patient_ID]
VAR __Date = Patient[Date]
VAR __Table =
FILTER ( ALLSELECTED ( Patient ), [Patient_ID] = __Patient && Patient[Date] <= __Date && Patient[Visit_Type] <> "New Consult" )
RETURN
IF ( Patient[Visit_Type] = "New Consult", IF ( NOT ISEMPTY ( __Table ), "Yes", "No" ) )
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Thank you, but that didn't seem to give the desired results. Please see highlighted below.
189 and 190 are no because they do not show up again in the table with a "Procedure" Visit_Type like 187 and 188 do.
@db400 why 189 and 190 are no? What's the logic?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
71 | |
70 | |
43 | |
31 | |
26 |
User | Count |
---|---|
89 | |
49 | |
44 | |
38 | |
37 |