Forum Discussion
Calculated Colomn taking too much memory
- Anonymous6 years ago
HI arzukari ,
Instead of creating Calculated Column, try using them in the same Summarize function.
Also, using Calculate function in Column creates rows transitions which is not recommended.
Table2 = SUMMARIZE(Table1,Table1[PatientID],"LAst Result", LASTNONBLANK(Table1[Result],True()))Regards,
Harsh Nathani
- Anonymous6 years ago
// The easiest way to generate PatientID's is to exec: [Calculated Table] = // calculated table distinct( 'Main Table'[PatientID] ) // I understand you want to get the first result // for the patient which means the result on the // very first date recorded in the table. To get // such a result, all of them must be ordered. I assume // that only 1 result is possible for any patient // on any single date. If this is not true, you have // to have something (e.g., a time column) that would // be used to break ties. Please steer clear of // CALCULATE in calculated columns as this will // slow down calculations and will in fact bring them // to a halt for big tables. First Result = // calculated column in the 2nd table var __patientId = 'Calculated Table'[PatientID] var __result = MAXX( // Again, this will work OK only if // there are no ties for the same // patient id on the same day. TOPN(1, filter( 'Main Table', 'Main Table'[PatientID] = __patientId // I also assume that there are no // blanks in the Result column. If // there are you have to filter them // out like: // 'Main Table'[Result] <> BLANK() ), 'Main Table'[Result Date], DESC // If you have a column to break ties // you'll put it in here as well specifing // it's order. If it were a time column, // you'd write // 'Main Table'[Result Time], // DESC ), 'Main Table'[Result] ) return __result
Anonymous Thank you for the response.
Adding the expression into the SUMMARIZE table works great for some of the requirements. But many of the other requirements need more logical expressions that it becomes too complicated. Is there anything I can do directly into calculated columns?
Hi arzukari ,
Try using measures for those.
https://www.youtube.com/watch?v=SVEGfqCTodc
You can also explore the option to do some of the calculations in Power Query.
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)