tips &tricks
2 TopicsCalculate Sum and Filter with IF conditions
Hi, I have a monthly trend table where I need to calculate the sum of patients with few filters and conditions applied. See the below measure - Patients_Adj = var test = CALCULATE(SUM(Patients[Patients]),Patients[TYPE] = "Paid", Patients[PRODUCT_FK] = "Product A") return IF(MAX('Date'[Month])>=[max_Date],test,0) This measure is giving correct output at row level, but totals are incorrect because this is doing the aggregation first and then applying the return condition. Is there a way I can re-write this measure so that conditions are applied first and then the sum aggregation happens. This is important because I need to calculate the cumulative number on top of this measure so that totals has to be accurate. Below is the table that I am using - Thanks!807Views0likes3CommentsSum of Max at row level in a measure with filters
Hi, I want to be able to create a calculation at row level in a measure without adding a calculated column. In my Patient data, I want to calculate the sum of patients for each month but before calculating sum, I want to apply a condition at row level which is Max(Patients, 0). I am able to achieve this using the following measure - test - Max at row level = CALCULATE(SUMX(Patients,MAX(Patients[Patients],0))) But I want to able to apply filters like Type = "Paid" and Product = "Product A" and I am not sure how to that in the above mesure so that it keeps the calculation intact. Please let me know if you have any solutions. The client is not keen on adding a column in the data and wants to calculate everything in a measure. Thanks!Solved1.5KViews0likes6Comments