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
jagostinhoCT
Post Partisan
Post Partisan

list the most recent value in a calculated table

Hello,

 

I have datasource where I list all audits performed to a project.

 

I then have a calculated table that filters out the last ones audited in the last 30 days. These are considered "recent". Using the formula below

= Table.SelectRows(#"Renamed Columns", let latest = List.Max(#"Renamed Columns"[AuditDate]) in each Date.IsInPreviousNDays([AuditDate], 30) or [AuditDate] = latest)

 

But it snaps when a project is audited that was still within those 30 days. This is because it is trying to add the same value twice to in a one-to-one column.

 

How can I fix it?

 

Thank you for your help.

 

1 ACCEPTED SOLUTION
v-sihou-msft
Employee
Employee

Hi,

 

In this scenario, since you want to get the most recent 30 records from the table, you can create a numeric date key column in your table, and use TOPN() function to create you calcualted table.

 

Recent 30 Days = TOPN(30,Table,Table[DateKey])

 

Regards,

Simon

View solution in original post

1 REPLY 1
v-sihou-msft
Employee
Employee

Hi,

 

In this scenario, since you want to get the most recent 30 records from the table, you can create a numeric date key column in your table, and use TOPN() function to create you calcualted table.

 

Recent 30 Days = TOPN(30,Table,Table[DateKey])

 

Regards,

Simon

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.