Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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
1 ACCEPTED SOLUTION

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:

v-kelly-msft_1-1619769004824.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous , for that you can create whatif parameter and use

 


measure =
var _par = maxx(allselected(parameter), parameter[parameter])
return
calculate(count(Table[customer]), filter(Table, Table[Days to Close] <=_par))

 

https://docs.microsoft.com/en-us/power-bi/desktop-what-if

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

 

PowerBi_Batman_1-1619590178350.png

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

 

PowerBi_Batman_0-1619590145934.png

 

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:

v-kelly-msft_1-1619769004824.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

Anonymous
Not applicable

thankyou thats perfect

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.