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
Anonymous
Not applicable

Retrieve Last Occurrence of each record per week

Hi, 

 

I would like to retrieve in a new column in DAX, called Last Occurrence, 1 for the last occurence of each record, per week and 0 for the others. 

 

Below is what I want to replicate. 

 

Many thanks in advance,

Melisa

recorddateweeknoLast Occurrence
10014822/11/202070
10014822/13/202070
10014822/14/202070
10014822/15/202071
10014822/17/202080
10014822/18/202080
10014822/19/202081
10014822/24/202090
10014822/25/202090
10014822/26/202091
12543332/11/202070
12543332/13/202070
12543332/14/202071
12543332/17/202080
12543332/18/202081
12543332/24/202090
12543332/25/202090
12543332/26/202090
12543332/27/202091

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

Try a new column like

 

 

Last Occurrence = if(table[date] - maxx(filter(table,table[record]=earlier(table[record]) && table[week]=earlier(table[week])),table[date]), 1, 0)

 

 

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

Try a new column like

 

 

Last Occurrence = if(table[date] - maxx(filter(table,table[record]=earlier(table[record]) && table[week]=earlier(table[week])),table[date]), 1, 0)

 

 

Anonymous
Not applicable

Hi @amitchandak 

Unfortunately the datemaxx function you mentioned in the formula is not recognized by Power BI. Can we use smtg else instead?

Thank you,

Melisa

 

Anonymous
Not applicable

@amitchandak I have used the MAXX function and it's working. Thank you very much!

 

Thanks for pointing out. I corrected the original post. Kudos to You !!

 

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.