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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

How to design a filter so that the most recent month with transactions will be displayed

Say I got a sales table, how do I set a filter so that the displayed month = max (sales date)? EG if the most recent transaction is June 2016, set the filter to monthyear = June 2016.

6 REPLIES 6
v-qiuyu-msft
Community Support
Community Support

Hi @Anonymous,

 

In your scenario, you can create a measure to get the most recent date. Then create a custom column into the table to tell us which rows have most recent date. Then add this new column on Visual/ Page/ Report filter property. For more information, please refer to this blog: Finding the Latest Date in Power BI Desktop .

 

If you have any question, please feel free to ask.

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@v-qiuyu-msft Thanks this came in with a blog page which looked very promising as to resolving what I need because I can use the filter in the page or report level. However, I was stopped when trying to create the custom column. I got the error "function 'Calculate' is not allowed as part of calculated column DAX expressions on DirectQuery mode". I guess the solution only works under import mode?

Hi @Anonymous,

 

There are a set of DAX functions that have been disabled by default in DirectQuery mode. This is done in order to avoid performance issues with these functions when working in DirectQuery mode, as these calculations can get very expensive to run in the server.

 

In your scenario, if you want to allow “unrestricted measures” in DirectQuery mode, you can enable this option in the Options dialog.

 

z1.PNG

 

Reference:
Ability to create measures when using DirectQuery mode

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@v-qiuyu-msft Sorry. The option is already enabled.

Hi @Anonymous,

 

Based on my test, the CALCULATE() function is not available in custom column DAX expression, which is the same as error stated "Function 'CALCULATE' is not allowed as part of calculated column DAX expressions on DirectQuery models.". In your scenario, please use connection mode as Import mode instead of DirectQuery mode then follow the steps in the article to finish your job. And you can click Refresh button to get the latest data. Smiley Happy

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
achinm45
Advocate IV
Advocate IV

Hi @Anonymous

You can do following :

1) Create  measures which will return Month of last transaction i.e. MAXMONTH = Month(MAX(Date) and another for Year i.e. MAXYEAR= YEAR(MAX(DATE))

2) Now in your calculations you have to put filter condition for filtering example

FILTER(SalesTable,Month(SalesTable[Date])=MAXMONTH && Month(SalesTable[Date])=MAXYEAR  )

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors