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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
tgibble
Frequent Visitor

DAX Formula - Calculate Day Number based on # of Claims

Hello Power BI Community,

I have a set of data that tracks the number of claims by date for 2 sites.  I am looking for a DAX formal that calculates the first day the total number clams reach 5 for a given site, then counts on from there.  See the example of he the dataset below.  For site A the first day was 3/3/20, and day 2 was 3/4/20.  For site B, day 1 was 3/2/20, day 2 was 3/3/20, and day 4 was 3/4/2020.    

 

Date

Site

# of Claims

Day

3/1/20

Site A

0

0

3/1/20

Site B

0

0

3/2/20

Site A

3

0

3/2/20

Site B

5

1

3/3/20

Site A

5

1

3/3/20

Site B

6

2

3/4/20

Site A

8

2

3/4/20

Site B

9

3

 

Thanks,

Tim

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hi @tgibble 

try a measure

Day = 
var _first5 = CALCULATE(MIN('Table'[Date]),ALLEXCEPT('Table','Table'[Site]),'Table'[# of Claims]=5)
return
CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[Site]),DATESBETWEEN('Table'[Date],_first5,SELECTEDVALUE('Table'[Date])))

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

2 REPLIES 2
az38
Community Champion
Community Champion

Hi @tgibble 

try a measure

Day = 
var _first5 = CALCULATE(MIN('Table'[Date]),ALLEXCEPT('Table','Table'[Site]),'Table'[# of Claims]=5)
return
CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[Site]),DATESBETWEEN('Table'[Date],_first5,SELECTEDVALUE('Table'[Date])))

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
tgibble
Frequent Visitor

Thanks, @az38.  This worked!!!!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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