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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
User7664
Helper I
Helper I

Adding a custom 'MAXIFS' column on a calculated table

Hi

I have a calculated table in my model which contains the dates from another table. Within that table is a week number which looks at the MAX date in the table and then counts back 7 days. The 7 biggest days in the table are therefore week -1, the next 7 are week -2 etc.

I am trying to add a new column which will show the max date relative to the week number. In the screenshot below every row from week -8 would show 17 Jan 2021, for week -7 it would show 24 Jan 2021 etc.

In excel i would run MAXIFS(DATE,WeekNumber,<the cell along side>) or similar.

You can see the attempt i've made but with little success.

Any guidance would be swell

Screenshot 2021-03-09 190928.png

2 ACCEPTED SOLUTIONS
dpotta
Resolver I
Resolver I

Hi

 

Are you trying to show the EOW date? 

 

Column = MOD([Date]-1, 7) + 6

 

You might need to change the -1 to a different number depending on your week date.

 

Also, check out date functions in Power Query. There are a tonne to sort out this sort of prob!

 

https://docs.microsoft.com/en-us/powerquery-m/date-functions

View solution in original post

Vera_33
Resident Rockstar
Resident Rockstar

Hi @User7664 

 

Try it

Column = 
VAR CurWeek = ABS('Table'[Week Number])
RETURN
MAXX(FILTER('Table',ABS('Table'[Week Number])= CurWeek),'Table'[Date])

Vera_33_0-1615340157857.png

 

View solution in original post

5 REPLIES 5
Vera_33
Resident Rockstar
Resident Rockstar

Hi @User7664 

 

Try it

Column = 
VAR CurWeek = ABS('Table'[Week Number])
RETURN
MAXX(FILTER('Table',ABS('Table'[Week Number])= CurWeek),'Table'[Date])

Vera_33_0-1615340157857.png

 

Amazing. Thank you. 

User7664
Helper I
Helper I

No, im not trying to find the end of the week. The end of the week will always be the last day in the query that this table is generated from. The End of the week can often be a tuesday or a thursday. The -1 indicates all the days part of that week, and the -2 are all the days part of the 2nd week back. I just need to know what the last day in -1 is and the last day in -2 is etc.

dpotta
Resolver I
Resolver I

Hi

 

Are you trying to show the EOW date? 

 

Column = MOD([Date]-1, 7) + 6

 

You might need to change the -1 to a different number depending on your week date.

 

Also, check out date functions in Power Query. There are a tonne to sort out this sort of prob!

 

https://docs.microsoft.com/en-us/powerquery-m/date-functions

User7664
Helper I
Helper I

Could this be cause i use roundup on my week number calculation?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.