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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

count of frequency of overlaps based on time intervals

Hi, I would like to count the number ofoverlaps of 2 variables (drug 1 and drug 2) by duration; where the interval of drug 1 <90 days and interval of drug 2 <30 days.

In other words, how many occurance of drug 2 between the 90 days window of drug 1

 

fakladios_0-1606487795790.png

fakladios_1-1606487821836.png

 

Thank you so much and your help will be grealy appreciated

regards,

Fady

 
 

Note: The following measure was created but it did not calculate the proper frequency of overlap

 

CoAdmin Logic_MEASURE =

VAR vByeUswe = CALCULATETABLE(SUMMARIZE('Transformed Table', 'Transformed Table'[Date]),'Transformed Table'[Drug] = "2", 'Transformed Table'[Disp Inrtevals]<=30, 'Transformed Table'[Disp Inrtevals]>0)

VAR vIns = CALCULATETABLE(SUMMARIZE('Transformed Table', 'Transformed Table'[Date]), 'Transformed Table'[Drug] = "1", 'Transformed Table'[Disp Inrtevals]<=90, 'Transformed Table'[Disp Inrtevals]>0)

VAR Result = COUNTROWS(UNION(vByeUswe, vIns))

RETURN

Result

 

4 REPLIES 4
Anonymous
Not applicable

data sample

Index IDDrugDispDATEInrtevalsOverlap logic
0129/09/2012 282
1127/10/2012 282
21218/11/2012 424
31227/01/2013 704
41210/03/2013 424
51121/04/2013 421
6125/05/2013 142
7115/05/2013 141
8122/06/2013 282
91216/06/2013 142
101128/07/2013 421
111211/08/2013 142
121111/08/2013 141
131216/06/2013142

 

AntrikshSharma
Community Champion
Community Champion

@Anonymous What was wrong in your result? Please attach sample data, desired/correct result and how you are trying to visualize it.

Anonymous
Not applicable

fakladios_0-1606702731468.png

 

I managed to build a count of seq function in excel as shown above using nested if (as shown above) to count sequence of 1 followed by 2. Is it possible to build a similar measure in Dax

 

Thank you in advance and your help will be greatly appreciated

 

Fady

Anonymous
Not applicable

The Desired output : calculate the count of overlaps of logic 2 (drug 2 and interval =<30) happening in between logic 1 (drug 1 and interval =<90) for the same ID...In other words, we want to identify the sequential pattern of 1,2,1 or 1,2,2,1 in the table and count those overlaps 

 

Thank you so much.

 

Fady

 

fakladios_1-1606569776275.png

Note: : the previous measure shown earlier created a count of all rows in calculated table joining logic 2 and logic 1 but ignoring the dersired sequence of intervals, resuling in overestimating the occurences

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors