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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Group by and show earliest date

Hello,

I have the next table:

ReminderRowIDReminderIDContractNrContractStartDateReminderDateCustomerID
1R1C11-1-20193-1-20191001
2R1C11-1-20193-1-20191001
3R2C23-1-201910-2-20191002
4R3C23-1-201911-3-20191002
5R3C23-1-201911-3-20191002
6R4C35-1-201910-4-20191003
7R5C35-1-20195-6-20191003

 

I would like to group by all unique contractnumbers in the table above and show the FIRST reminderdate. After that I would like to calculate the datediff between the contractstartdate and the first reminderdate. 

 

So it will look like this:

ContractnrContractStartDateFIRST ReminderdateDaysBetween
C11-1-20193-1-20192
C23-1-201910-2-201938
C35-1-201910-4-201995

 

Last of all, I would like to calculate the number of customers that have received their first reminder on a contract withing 30 days...

Could somebody help me fix this business case with DAX?

Thank you!

6 REPLIES 6
az38
Community Champion
Community Champion

@Anonymous 

my above solution returns you result that you asked for

Снимок.PNG


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

Hi @Anonymous 

try a measure

 

DaysBetween = 
var _firstReminder = CALCULATE(MIN('Table'[ReminderDate]),ALLEXCEPT('Table','Table'[ContractNr]))
return
datediff(selectedvalue('Table'[ContractStartDate]),_firstReminder,DAY)

and measure t count customers within 30 days

COUNTCUSTOMER = calculate(DISTINCTCOUNT('Table'[CustomerID]),FILTER(ALL('Table'),[DaysBetween]<=30))

 


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

Hi @Anonymous 

New table=Summarize(table,table[ContractNr],table[ContractStartdate],table[Reminderdate],"Between",datediff(max(table[ContractStartdate]),max(table[Reminderdate]),Day))

 

Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar

If I resolve your problem Mark it as a solution and give kudos.

 

Anonymous
Not applicable

Hi @Anonymous 
unfortunately it didn't work out for me

Anonymous
Not applicable

Hi @Anonymous  Have you tried the solution which i have suggested?

 

Thanks,

Pravin

Anonymous
Not applicable

Could you please share what output you are getting after table creation?

 

Thanks,

Pravin

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.