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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors