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
Anonymous
Not applicable

Writing a measure to filter dates greater than TODAY()

I have a table containing dates ranging from 1st Jan 2018 ro 31st Dec 2021. I want to write a measure which will filter the table and return all the dates greater than TODAY(). I want to plot a graph against all the upcoming dates in the future.
Is there a way I can do this?
I don't want to use a slicer.

1 ACCEPTED SOLUTION
V-pazhen-msft
Community Support
Community Support

@Anonymous 
There are a few way to write that dax, you can create a measure or a calculate column. Try:

Measure = Calculate(sum([Date]),Filter(All(Table), [Date]>Today()))
OR
Column = IF([Date]>TODAY(),[Date],BLANK())

greater than today.JPG


Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

4 REPLIES 4
pranit828
Community Champion
Community Champion

Hi @Anonymous 

I wouldn't use a slicer neither a measure. I will filter it as below.

pranit828_0-1597984511163.png

 





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile
V-pazhen-msft
Community Support
Community Support

@Anonymous 
There are a few way to write that dax, you can create a measure or a calculate column. Try:

Measure = Calculate(sum([Date]),Filter(All(Table), [Date]>Today()))
OR
Column = IF([Date]>TODAY(),[Date],BLANK())

greater than today.JPG


Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

amitchandak
Super User
Super User

@Anonymous , better to use relative date slicer

https://docs.microsoft.com/en-us/power-bi/visuals/desktop-slicer-filter-date-range

 As a slicer or at visual or page level filter.

 measure can group data into one row

 

Like

measure =
var _max = today()
return
CALCULATE(
COUNT ('Table'[Value]),FILTER(ALLSELECTED('Table'),'Table'[Date] <= _max))

 

or

 

measure =
var _max = today()
return
CALCULATE(
COUNT ('Table'[Value]),FILTER(('Table'),'Table'[Date] <= _max))

 

Also, refer to this video

https://www.youtube.com/watch?v=duMSovyosXE

amaleranda
Post Patron
Post Patron

@Anonymous ,

 

Try using below measure

GreaterThanToday =
VAR Result = IF(TODAY() > MAX(Calender[Date]), "Past Day", "Future Day")

RETURN
Result
 
it works better if you have a calander tabel in your data model

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.