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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
madan27
Frequent Visitor

Month MAX record

Hi 

 

I need to filter the records based on Mnth MAX date avillable within the table

 

I am having a table as below

 

DateDepartmentSalary
1/31/2017Engineering80000
1/31/2017HR60000
2/10/2017HR62000
2/13/217Engineering85000
2/28/2017Engineering87000
2/28/2017HR65000
4/11/2017Engineering90000
4/11/2017HR70000

 

From the above table I need to get the below result

 

DateDepartmentSalary
1/31/2017Engineering80000
1/31/2017HR60000
2/28/2017Engineering87000
2/28/2017HR65000
4/11/2017Engineering90000
4/11/2017HR70000

 

As a Part of January '1/31/2017' is MAX Date and get all the rows that fall under this date.

In the month of April '4/11/2017' is the MAX data that is avillable within the table.

 

I am using direct query, kindly suggest some solutions to achive this without using import.

 

Thanks in advance.

1 ACCEPTED SOLUTION
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @madan27,

You can get max date in one month, then filter it based on the new column, please follow up the following steps.

First, create calculated columns using the formulas.

Month = MONTH(Test[Date])
Max_date_in_one_month = CALCULATE(MAX(Test[Date]),ALLEXCEPT(Test,Test[Month]))

1.PNG

Then, click "New table" under modeling on home page, create a new table using the formula.

Table = SELECTCOLUMNS(FILTER(Test,Test[Date]=Test[Max_date_in_one_month]),"Date",Test[Date],"Department",Test[Department],"Salary",Test[Salary])

 

2.PNG

Please feel free to ask if you have any other issue.

Best Regards,
Angelia

View solution in original post

3 REPLIES 3
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @madan27,

If you have resolved your issue, please mark the right  reply or share your solution as workaround. So that more people will benefit from it.

Thanks,
Angelia

I tried to use the solution, but it gave me the message:

Function 'SELECTCOLUMNS' is not supported in DirectQuery mode.

When I was trying to set the formula table

v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @madan27,

You can get max date in one month, then filter it based on the new column, please follow up the following steps.

First, create calculated columns using the formulas.

Month = MONTH(Test[Date])
Max_date_in_one_month = CALCULATE(MAX(Test[Date]),ALLEXCEPT(Test,Test[Month]))

1.PNG

Then, click "New table" under modeling on home page, create a new table using the formula.

Table = SELECTCOLUMNS(FILTER(Test,Test[Date]=Test[Max_date_in_one_month]),"Date",Test[Date],"Department",Test[Department],"Salary",Test[Salary])

 

2.PNG

Please feel free to ask if you have any other issue.

Best Regards,
Angelia

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon & SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.