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

Filter records for certain range

Hi,

I have  data for which I want to apply  a DAX filter of last four month , where my current date is as below.

Current day=today-45 days, kindly help me with the logic for this

 

Regards,

1 ACCEPTED SOLUTION
v-yuezhe-msft
Employee
Employee

@Anonymous,

Do you want to show data from last four months(Current day-four months) to Current day(today-45 days)?

If so, create the following columns in your table. Then use the Date Range column in slicer to filter your visuals.

Current Day = TODAY()-45

Date Range = IF('Table'[DateKey]<='Table'[Current Day]&&'Table'[DateKey]>= 'Table'[Current Day]-120,1,0)

However, if you want to calculate last four months using today-4 months, then create Date Range column using the DAX below.

Date Range = IF('Table'[DateKey]<='Table'[Current Day]&&'Table'[DateKey]>=TODAY()-120,1,0)

Regards,

 

Community Support Team _ Lydia Zhang
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

2 REPLIES 2
v-yuezhe-msft
Employee
Employee

@Anonymous,

Do you want to show data from last four months(Current day-four months) to Current day(today-45 days)?

If so, create the following columns in your table. Then use the Date Range column in slicer to filter your visuals.

Current Day = TODAY()-45

Date Range = IF('Table'[DateKey]<='Table'[Current Day]&&'Table'[DateKey]>= 'Table'[Current Day]-120,1,0)

However, if you want to calculate last four months using today-4 months, then create Date Range column using the DAX below.

Date Range = IF('Table'[DateKey]<='Table'[Current Day]&&'Table'[DateKey]>=TODAY()-120,1,0)

Regards,

 

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ibarrau
Super User
Super User

Hi, did you try relative date slicer of the preview features? I think this post can help you because it have different approaches

 

http://community.powerbi.com/t5/Desktop/Filter-to-select-last-month-and-the-weeks-of-the-last-month/...

 

Regards,


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.