Forum Discussion
Count rows After specific date
- 8 years ago
Hi there,
Happy to help. So what you'll want is to use COUNTROWS as you've specified. What I'd do instead though is create two measures first. a MAX of the Install Date, and a MAX of the Open Date.
MAX Date/Time Opened = MAX('Dispenser Issues'[Date/Time Opened])MAX Install Date = IF(MAX('Master Site List'[Install Dates]), MAX('Master Site List'[Install Dates]), TODAY())I also included an IF statement in the install date where if blank, then return today's date. That way the comparison shouldn't have any false positives for comparison. The final query would be below for the count of cases where the opened date was after install date. I wrapped the final query in an X function of COUNTAX, that way the grand total will be a total count of every value that as included as part of the IF statement.
Case Number Count Open After Install Date = COUNTAX('Dispenser Issues', IF([MAX Date/Time Opened] > [MAX Install Date], COUNTROWS('Dispenser Issues')))I've emailed the workbook back as well. Hope this helps!
- 8 years ago
You're definitely right. Thought too quickly and over engineered it. The solution below works fine, if you want to account for blank dates for install date you can also use the slightly modified solution as well.
Case Number Count Open After Install Date = CALCULATE ( COUNTROWS ( 'Dispenser Issues' ), FILTER ( 'Dispenser Issues', 'Dispenser Issues'[Date/Time Opened] > IF ( RELATED ( 'Master Site List'[Install Dates] ), RELATED ( 'Master Site List'[Install Dates] ), TODAY () ) ) )
Hi there,
Happy to help. So what you'll want is to use COUNTROWS as you've specified. What I'd do instead though is create two measures first. a MAX of the Install Date, and a MAX of the Open Date.
MAX Date/Time Opened = MAX('Dispenser Issues'[Date/Time Opened])
MAX Install Date
= IF(MAX('Master Site List'[Install Dates]), MAX('Master Site List'[Install Dates]), TODAY())I also included an IF statement in the install date where if blank, then return today's date. That way the comparison shouldn't have any false positives for comparison. The final query would be below for the count of cases where the opened date was after install date. I wrapped the final query in an X function of COUNTAX, that way the grand total will be a total count of every value that as included as part of the IF statement.
Case Number Count Open After Install Date = COUNTAX('Dispenser Issues', IF([MAX Date/Time Opened] > [MAX Install Date], COUNTROWS('Dispenser Issues')))I've emailed the workbook back as well. Hope this helps!
- JaromBuys8 years agoFrequent Visitor
Reid_Havens wrote:Hi there,
Happy to help. So what you'll want is to use COUNTROWS as you've specified. What I'd do instead though is create two measures first. a MAX of the Install Date, and a MAX of the Open Date.
MAX Date/Time Opened = MAX('Dispenser Issues'[Date/Time Opened])MAX Install Date = IF(MAX('Master Site List'[Install Dates]), MAX('Master Site List'[Install Dates]), TODAY())I also included an IF statement in the install date where if blank, then return today's date. That way the comparison shouldn't have any false positives for comparison. The final query would be below for the count of cases where the opened date was after install date. I wrapped the final query in an X function of COUNTAX, that way the grand total will be a total count of every value that as included as part of the IF statement.
Case Number Count Open After Install Date = COUNTAX('Dispenser Issues', IF([MAX Date/Time Opened] > [MAX Install Date], COUNTROWS('Dispenser Issues')))I've emailed the workbook back as well. Hope this helps!
Hello Reid,Thank you, this modified solution worked perfectly. Because we do have blanks in the install date, we will want to take that into account.