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.
Hi there!
Please see attached screenshot to clarify my needs:
I'm trying to find the time elapsed between the dateperformed column for each patient, but don't want the time elasped between the dates if the patientIDS aren't the same because that data is irrelevant to me and messes up my visuals. My goal for a new calculated column is, if the patientIDs are the same, return the value in the timelapsedFilterNeg column, and if they are not, return 0. My trouble is I am not sure how to write the formula that says "if the previous value in this column is the same as the next value...".
I am aware that the patientID string is a mixture of numbers and digits, and I have no problem adding a column of only integers to represent the patientID if needed.
Please let me know if I can clarify the issue in any way, thanks!
Solved! Go to Solution.
Hi @newtonvr ,
Use the index column to create a new index column for each patientID.
new_index = RANKX(FILTER('Table','Table'[id]=EARLIER('Table'[id])),'Table'[index],,ASC)
Then you could compare the value depends on the new index column.
Column =
var earlier_value = CALCULATE(SUM('Table'[value]),FILTER('Table','Table'[id]=EARLIER('Table'[id])&&'Table'[new_index]=EARLIER('Table'[new_index])-1))
return
IF(ISBLANK(earlier_value),0,'Table'[value]-earlier_value)
Best Regards,
Jay
Hi @newtonvr ,
Use the index column to create a new index column for each patientID.
new_index = RANKX(FILTER('Table','Table'[id]=EARLIER('Table'[id])),'Table'[index],,ASC)
Then you could compare the value depends on the new index column.
Column =
var earlier_value = CALCULATE(SUM('Table'[value]),FILTER('Table','Table'[id]=EARLIER('Table'[id])&&'Table'[new_index]=EARLIER('Table'[new_index])-1))
return
IF(ISBLANK(earlier_value),0,'Table'[value]-earlier_value)
Best Regards,
Jay
@newtonvr , based on what I got, Try a new column like
datediff( maxx(filter(Table, [patientID] = earlier([patientID]) && [Date] < earlier([Date])),[Date]),[Date], day)
Following your advice, I created a new column with the following formula:
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
99 | |
73 | |
72 | |
49 |
User | Count |
---|---|
145 | |
109 | |
109 | |
90 | |
64 |