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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
cocoblb
Frequent Visitor

Filter dataset for previous month data

I see a few similar Dax queries to what I am trying to achieve but the only problem is I am not looking for a sum or total. I simple just want to filter the data set for last months data only. This is what I have so far but it is not working. Any ideas on how to get this to work?

 

DEFINE
VAR CostFilter = filter('Table01','Table01'[Date] >= date(year(now()),month(now()),1))

VAR Costcolumns = SUMMARIZECOLUMNS(
'Table01',
'Table01'[Tags - Copy.DepartmentNumber],
'Table01'[Tags - Copy.OwnerEmail],
'Table01'[Cost],
'Table01'[Date]

)
evaluate
Costcolumns

1 REPLY 1
tamerj1
Super User
Super User

Hi @cocoblb 

Please try

DEFINE
VAR CostFilter = FILTER(VALUES(Table01'[Date]), 'Table01'[Date] >= EOMONTH ( TODAY ( ), - 1 )  + 1 )

VAR Costcolumns = SUMMARIZECOLUMNS(
'Table01',
'Table01'[Tags - Copy.DepartmentNumber],
'Table01'[Tags - Copy.OwnerEmail],
'Table01'[Cost],
'Table01'[Date],

TREATAS ( CostFilter, 'Table01'[Date] )

)
evaluate
Costcolumns

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.