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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ingridf
Regular Visitor

Aggregate events to longer episodes

I am trying to create new table (Table 2) based on an existing table (Table 1).

I have tried EARLIER, but do not know how to make it work if the patient is coming back?
Also, I tried to merge the two columns TypeOfVisit and Status (to something like Start---X, X---X, C---Closed etc..), but it didn’t help my progress either ;P.

 

Table 1, Contains a couple of visits to a physican

Patient

EventID

DateOfVisit

TypeOfVisit

Status

A

1

2018-01-01

Start

X

A

2

2018-01-02

X

X

A

3

2018-01-03

X

Closed

A

4

2018-05-01

Start

X

A

5

2018-06-01

X

Closed

B

6

2018-01-01

Start

Closed

B

7

2018-02-01

Start

X

 

Table 2

Patient

EpisodID

StartDate

EndDate

A

A1

2018-01-01

2018-01-03

A

A2

2018-05-01

2018-06-01

B

B1

2018-01-01

2018-01-01

B

B2

2018-02-01

Ongoing

 

For each patient;

StartDate: The date when column TypeOfVisit = ”Start” in Table 1

EndDate: The date when column Status = ”Closed” in Table 1

If a patient is reoccuring (i.e. gets another ”Start” in Table 1), a new episodID is to be created

 

/Ingrid

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

Please find the solution. Only one diff, I kept episodId ad Number and named as Visit No.

https://www.dropbox.com/s/4u5y8obfcj1vwnr/physicianVisit.pbix?dl=0

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

Please find the solution. Only one diff, I kept episodId ad Number and named as Visit No.

https://www.dropbox.com/s/4u5y8obfcj1vwnr/physicianVisit.pbix?dl=0

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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