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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Anonymous
Not applicable

Single Date Selection filtering data up to the selected date

I have a requirement where I need a single date filter selection like below.

Date.jpg

 

When the user selects any date, the report should filter data from the first of that month to selected date.

 

Example:

If the users selects 01/15/2019, then data should be filtered from 01/01/2019 to 01/15/2019.

If the users selects 12/26/2018, then data should be filtered from 12/01/2018 to 12/26/2018.

 

This is a kind of dynamic MTD.

 

Need help in achieving this requirement

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

If your table contains the continuous date column, you could try the way below. If your date column is not continuous, I'm afraid that you should create a table with the date missed and then join the tables to get a continuous date column.

 

1. Create the Calendar table and don't create the relationship between the original table and the Calendar table.

 

2. Create the Date slicer with the date column in Calendar table.

 

3. Create a measure with the formula below to get the records base on your selection.

Measure = IF(SELECTEDVALUE('Table'[Date])<=SELECTEDVALUE('Calendar'[Date]),1,0)

4. Create the MTD measure with the formula.

 

MTD =
CALCULATE (
    SUM ( 'Table'[Amount] ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        MONTH ( 'Table'[Date] ) = MONTH ( MAX ( 'Table'[Date] ) )
            && 'Table'[Date] <= MAX ( 'Table'[Date] )
    )
)

Here is the output.

Capture.PNG

More details, please refer to the attachment.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
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
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous ,

 

It seems that you want to create the MTD.

 

If you have had a calendar table you could create the MTD measure with the formula below. If you don't have the calendar table , you could create it with CALENDARAUTO() function then create the relationship between the tables with Date column.

 

MTD = TOTALMTD(SUM('Table'[Amount]),'Calendar'[Date])

Here is the output.

 

MTD.PNG

 

More details, please refer to my attachment.

 

In addition, you could refer to this blog whihc may help you.

Calculating MTD, QTD, YTD, Running and Cumulative Total in Power BI

 

If you still need help, please share your data sample so that we could help further on it.

 

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-piga-msft ,

 

In addition to the MTD, I also need to filter the records in the table.

In your attached screenshot, there is a table with Date, Amount and MTD column. Also there is a Date filter. 

When we select any date from the date filter, the table should also be filtered.

 

If we select 1/3/2017 from the date filter, then data for 1/1/2017, 1/2/2017 and 1/3/2017 should be displayed in the table. Therefore only 3 records should be displayed in the table.

 

If we select 1/10/2017, then data from 1/1/2017 to 1/10/2017 should be displayed.

 

Thank you for your help.

 

Regards,

Ravin

Hi @Anonymous ,

 

If your table contains the continuous date column, you could try the way below. If your date column is not continuous, I'm afraid that you should create a table with the date missed and then join the tables to get a continuous date column.

 

1. Create the Calendar table and don't create the relationship between the original table and the Calendar table.

 

2. Create the Date slicer with the date column in Calendar table.

 

3. Create a measure with the formula below to get the records base on your selection.

Measure = IF(SELECTEDVALUE('Table'[Date])<=SELECTEDVALUE('Calendar'[Date]),1,0)

4. Create the MTD measure with the formula.

 

MTD =
CALCULATE (
    SUM ( 'Table'[Amount] ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        MONTH ( 'Table'[Date] ) = MONTH ( MAX ( 'Table'[Date] ) )
            && 'Table'[Date] <= MAX ( 'Table'[Date] )
    )
)

Here is the output.

Capture.PNG

More details, please refer to the attachment.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-piga-msft ,

 

Thank you for your help.

 

I needed that, If we select 1/10/2017, then data from 1/1/2017 to 1/10/2017 should be displayed.

If we select 2/15/2018, then data from 2/1/2018 to 2/15/2018 should be displayed, rest all should be filtered.

 

Your solution was very much helpful.

I just modified your measure formulae and it worked for me.

 

Regards,

Ravin 

 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.