Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Count if Accumulation

hi, trying to do a if statement then a count statement to calculate how long customer case items took to close

Currently created a date diff on the difference in days for items between Created Date and Closed Date. Output is in days

 

then i am forming an if statement to mark items in a new column based on the date ranges

 

IF('Escalation'[Days to Close] < 1, "1. < 1 Day",
IF('Escalation'[Days to Close] < 7, "2. < 1 week",
IF('Escalation'[Days to Close] < 30, "3. < 1 month",
IF('Escalation'[Days to Close] < 180, "4. < 6 months",
IF('Escalation'[Days to Close] < 365, "5. < 1 year", "6. 1 year + Older")))))

where i have failed is trying to put this into a count if statement or separate calculation
i am trying to calculate if the "Days to close" is marked as "2. < 1 week" then count everything marked with that field and also "1. < 1 day" as i truely want to calculate the totals that fall under each category. not just in that range (IF THAT MAKES SENSE)

so if i want to count, how many items close within 30 days, i want it to count up outputs 1, 2 and 3

hopefully make some sense
  • Hi  Anonymous ,

     

    Create a measure as below:

    Measure = CALCULATE(COUNTROWS('Escalation'),FILTER(ALL(Escalation),'Escalation'[Column]<=MAX('Escalation'[Column])&&'Escalation'[Priority]=MAX('Escalation'[Priority])))

    And you will see:

    For the related .pbix file,pls see attached.

     

    Best Regards,
    Kelly

    Did I answer your question? Mark my post as a solution!

4 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      thanks for reply amitchandak 
      not sure if whatif will help me table-ise the outputs as per below

      couldnt put a table in this reply, getting errors 
      but essentially need to put the outputs in a table with the below in columns


      < 1 day = count of items less than 1 day
      < 1 week = Count of items less than 7 days including items in the less than 1 day column
      <1 month = Count of items less than 30 days including items in the less than 1 day and less than week  column
      etc etc

       

      the below is how i want the output where by 65 is actually the sum of 9 + 65

       

       

      • v-kelly-msft's avatar
        v-kelly-msft
        Community Support

        Hi  Anonymous ,

         

        Create a measure as below:

        Measure = CALCULATE(COUNTROWS('Escalation'),FILTER(ALL(Escalation),'Escalation'[Column]<=MAX('Escalation'[Column])&&'Escalation'[Priority]=MAX('Escalation'[Priority])))

        And you will see:

        For the related .pbix file,pls see attached.

         

        Best Regards,
        Kelly

        Did I answer your question? Mark my post as a solution!