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
diederd
Helper II
Helper II

Create filter with year to date (in months)

Hello all.

 

I'm looking to create a filter which which would automatically create a list of dates (in months) for the year to date. An example of this being:

 

January

February

.

.

July

 

In August; the list should automatically create a new entry for August.

 

Any thoughts as to how to go about completing this. I have a Date Table which has the relevant fields; however unable to create a suitable filter to provide the functionality I require.

 

Thank you in advance.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Sorry, brackets issue. Try this.

 

Dynamic_table = CALCULATETABLE(Table1,FILTER(Table1,YEAR(Table1[Date])= YEAR(TODAY()) && MONTH(Table1[Date]) <= MONTH(TODAY())))

 

Thanks

Raj

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

i have a problem. please help me

i have 2 slicer one for month and other for year.

 

and i have table

name ,designation startingdate

am,software,2011-06-22

am,sr software,2013-06-22

v,manager,2013-08-30

 

so if i select 07 and year 2012 

i should see 

am,software,2011-06-22     

 

as his designation doesnot change between this period

Shantanu00007
Helper I
Helper I

Is there any date column in your table. If yes then does it contains dates till july or above for july month ?
Anonymous
Not applicable

Hi

 

You may have to d osomething like this in DAX.

 

Go to Modelling -> New Table-> Try this

 

Dynamic_table = CALCULATETABLE(Table1,
                  FILTER(Table1,YEAR(Table1[Date]= YEAR(TODAY())  &&  
MONTH(Table1[Date])<=MONTH(TODAY()))))

 

If this is what you want , then you can have just the required column.

 

Thansk
Raj

Rajendran

 

Thank you for your feedback; could you confirm as to what Table1 refers to? I do indeed have a date dimension table; which hopefully together with this calculatedtable should do the trick.

Anonymous
Not applicable

Yes, you can use the date table here.

 

Thanks

Raj

Thanks Raj

 

I've completed the steps below; unfortunately it's just created a duplicate of my date table (without the filtered criteria)

 

Dynamic Dates = CALCULATETABLE('Calendar',
FILTER('Calendar',YEAR('Calendar'[Date] = YEAR(TODAY()) && MONTH('Calendar'[Date]) <= MONTH(TODAY()))))

 

 

Anonymous
Not applicable

Sorry, brackets issue. Try this.

 

Dynamic_table = CALCULATETABLE(Table1,FILTER(Table1,YEAR(Table1[Date])= YEAR(TODAY()) && MONTH(Table1[Date]) <= MONTH(TODAY())))

 

Thanks

Raj

Raj.

 

You absolute genius!! Thank you - that has worked.. I've spent all day trying to figure it out; thank you for your help on getting this resolved for me.

 

Much appreciated!

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.