Forum Discussion
uk_tj
Advocate IV
9 years agoHelp dealing with "duplicate" rows within Summarize
Hi Guys, Could really use some assistance on this one... I have a table that shows processes assigned to sales and i need be able to report the number of sales per process state per process on a gi...
- 9 years ago
hi uk_tj,
I think I have cracked it at least against the sample data set.
created
1 testing measure and 2 filtering measures
//Find rows in date range in range = CALCULATE(COUNTROWS('sample'), FILTER('sample','sample'[validfrom] <= min(DATES[Date]) && 'sample'[validTo] >= MIN('DATES'[Date])))
//set rows to blank() if not in range //Find min datefrom per salesId MinDatePerGroup = if([in range] = 1, CALCULATE(min('sample'[ValidFrom]), filter(ALLEXCEPT('sample', 'sample'[SaleID]), [in range] = 1)), blank())//set rows to blank() if not in range
//find min ProcessState per salesId minProcessStatePerGroup = if([in range] = 1, CALCULATE(min('sample'[ProcessState]), filter(ALLEXCEPT('sample', 'sample'[SaleID]), [in range] = 1)), blank())with these mesure created I can count the rows where the date = the min date and the processState = the min ProcessState
Count = CALCULATE(COUNTROWS('sample'), filter('sample', [ValidFrom]=[MinDatePerGroup] && [ProcessState] = [minProcessStatePerGroup]))If there are two with the same state are the same then the min date wins, if the process states are different but the date is the same then the min process state wins.
link to the pbix below
uk_tj
Advocate IV
9 years agoBump
- richbenmintz9 years ago
Resident Rockstar
sorry, got sucked into work on Friday. I will try to get to it tonight or tomorrow