MVKXXX
MVKXXX

Reputation: 375

What is the DAX expression to filter data in a table by a Start date entered by Slicer Input?

I am a beginner and doing the first project in Power BI.

I have Dates table with "Date" column having first day of each month from 2020 to 2025 like - 1/1/2020,2/1/2020.....12/1/2025.

I have Orders table with "Date" column (having first day of each month from 2020 to 2025 like - 1/1/2020,2/1/2020.....12/1/2025) and Costs column.

I have a slicer "Start Date" with options like 1/1/2020,2/1/2020.....12/1/2025.

Problem Statement - After I select a Start Date value for example 10/1/2023, I have to get range of dates like 10/1/2023,11/1/2023...12/1/2025 from 'Dates'[Date].

  1. The lower limit of the range will be my selected date.
  2. Upper limit will always be the maximum date value of Dates table.

What I can do - I can generate a series of last 12 months from selected date. So, for selected date 10/1/2023 the range would be 11/1/2022 to 10/1/2023.

VAR PrevDates=DATESINPERIOD('Dates'[Date],RefDate,-12,MONTH) 
//RefDate holds the selected date

What I need to do- But how can I get the range of dates from the selected StartDate to the maximum date present in dates table?

Upvotes: 0

Views: 157

Answers (1)

Sia
Sia

Reputation: 536

In Slicer setting, choose 'After'. Then you can choose any start date and get the range of dates from the selected StartDate to the maximum date.

enter image description here

Upvotes: 0

Related Questions