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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
admin-unidoze
Frequent Visitor

DAX formule for measure to know if there is a next record in the same table

I have a dataset with Payments for a specific yearly subscription:

     ID, Customer, StartDate, EndDate, PaymentDate

When you renew your subscription, a new record is created in that Payments table, with the StartDate = EndDate previous + 1 and EndDate = StartDate + 12 months.

Example:

ID 1: Customer X: 15/02/2023 - 14/02/2024, Paid: 15/02/2023

ID 2: Customer X: 15/02/2024 - 14/02/2025, Paid: 09/02/2024

I want to create a measure in this dataset that indicates that there is a follow-up subscription.

So for ID 1: 
ID 1: Customer X: 15/02/2023 - 14/02/2024, Paid: 15/02/2023 => Yes, because there is a record ID 2 for the same customer and with StartDate equals to the EndDate of record with ID 1 + 1 day.

ID 2: Customer X: 15/02/2024 - 14/02/2025, Paid: 09/02/2024 => No, because there is no record for the same customer and with StartDate equals to the EndDate of record with ID 1 + 1 day.

 

But I really haven't a single idea on how to start on this ...

1 ACCEPTED SOLUTION
JamesFR06
Resolver IV
Resolver IV

Hi

 

A result with a new column in the table

JamesFR06_0-1709651941326.png

Test =
Var DepDate=Cust[EndDate]+1
var customer=Cust[Customer]
var result=
if(COUNTROWS(filter(Cust,Cust[Customer]=customer&&Cust[StartDate]=DepDate))=1,"Yes","No")
return
result

View solution in original post

2 REPLIES 2
JamesFR06
Resolver IV
Resolver IV

Hi

 

A result with a new column in the table

JamesFR06_0-1709651941326.png

Test =
Var DepDate=Cust[EndDate]+1
var customer=Cust[Customer]
var result=
if(COUNTROWS(filter(Cust,Cust[Customer]=customer&&Cust[StartDate]=DepDate))=1,"Yes","No")
return
result

Wauw thanks! This is absolutely the solution 🙂

Also the first time I work with inline variables in DAX so a good start for me!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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