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
socal225
Frequent Visitor

Date diff with duplicate values

Hello all,

 

I am trying to create a calculated column that gives the age (in days) between a date in a column and the current date. I then want to create an additional measure based on this one. The date column has duplicate values in a second column called "record no," and the problem is that when I create the "age" measure it sums up the age on the duplicate "record no" column, and that affects the second measure based on other parameters. In a nutshell, I want to see the age for each "record no" based on the date, but I don't want it to aggregate based on the multiple duplicate rows of record no. Thank you in advance!

 

Capture.JPG

3 REPLIES 3
dax
Community Support
Community Support

Hi @socal225 , 

If possible could you please inform me more detailed information(such as your expected output and your sample data )? Then I will help you more correctly.

Please do mask sensitive data before uploading.

Thanks for your understanding and support.
Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

harshnathani
Community Champion
Community Champion

Hi @socal225 ,

 

What are the other measures?

 

You can Calculated Columns

 

Days Elapsed = DATEDIFF('Table'[DateTime],Today(),DAY)
 
Ageing = IF (Table[Days Elapsed] > 50, "above 50 Days", "Below 50 Days")
 
 
and then create a measure
Ageing Details = COUNT(Table[RecordNo])
 
1.jpg
 
 
 
 Regards,
Harsh Nathani
 
jdbuchanan71
Super User
Super User

You could do it as a calcualted table that you link back to your main table based on the item number.

 

Table 2 =
ADDCOLUMNS (
    SUMMARIZE ( 'Table', 'Table'[Item], 'Table'[Date] ),
    "DateDiff", DATEDIFF ( 'Table'[Date], TODAY (), DAY )
)

If you can do it as a measure instead that might be easier.

DateDiff = 
VAR _ItemDate = SELECTEDVALUE('Table'[Date])
RETURN DATEDIFF(_ItemDate,TODAY(),DAY)

 

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.