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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Shadowestien
Frequent Visitor

Show data between 2 Date Filters

I want to show the data where the column "Termini" it's between "Termini Inicial" (Start Date) and "Termini Final" (Final Date).The 2 Date FiltersThe 2 Date Filters

1 ACCEPTED SOLUTION

Hi @Shadowestien ,

 

Delete the relationship between the tables, and then try the following formula to put the value of measure into the filter on this visual to show the result as 1.

vhenrykmstf_0-1638323454309.pngvhenrykmstf_1-1638323477828.pngvhenrykmstf_2-1638323526116.png

If the problem is still not resolved, please point it out or provide test pbix file. Looking forward to your reply.


Best Regards,
Henry


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

15 REPLIES 15
v-henryk-mstf
Community Support
Community Support

Hi @Shadowestien ,

 

Try a formula similar to the following, select the date values in each of the two slicers and filter out the corresponding values that meet the specified date.

M =
VAR a =
    SELECTEDVALUE ( slicer[Start] )
VAR b =
    SELECTEDVALUE ( slicer[End] )
RETURN
    CALCULATE (
        MAX ( 'Table_'[Value] ),
        FILTER (
            ALL ( Table_ ),
            MAX ( 'Table'[Date] ) <= b
                && MAX ( 'Table_'[Value] ) >= a
        )
    )


If the problem is still not resolved, are you able to provide some test data (remove sensitive information) to facilitate me to answer for you as soon as possible. Looking forward to your feedback.


Best Regards,
Henry


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, I'm having the same initial problem. My objective is show the data between two selected dates (start date and end date), both selected by different filters.

However, I could not implement this measure correctly. Could you share the .pbix file with this example?


Sorry for the English, I'm Brazilian. Thanks.

Hi, thank you so much for your answer it seems it can be what I need.
But I don't have full Knowledge about PowerBI, could you explain me how can I do this.

I mean I don't know what are the "reference name" of the filters, and this function where do I have to apply it?

 

Thanks again btw.

Hi @Shadowestien ,

 

Is your question confused about how to create formulas? Then type in the formula you want to try and save it. Put it into the corresponding table visual to display the corresponding results.

vhenrykmstf_1-1637893302762.png

vhenrykmstf_2-1637893462388.png

If there is still confusion, you can provide a sample pbix file and I will answer it for you as soon as possible.

 

Best Regards,
Henry


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

Hi, I updated my project and now I got 4 slicers "Start_Month" "Start_Year" "Last_ Month" "Last_Year.
On the table where I show the data I have the column "Termini" that's column I need filtering with the DateBetween.

I did this new measure (Mesures_PdG[Termini] is the column I want to filter 😞

FiltreTermini = 
VAR year1 =
    SELECTEDVALUE ( Anys[Any] )
VAR year2 =
    SELECTEDVALUE ( Anys[Any2] )
VAR month1 =
    SELECTEDVALUE ( Mesos[Mes_Ordre] )
VAR month2 =
    SELECTEDVALUE ( Mesos[Mes_Ordre] )
VAR startDate =
    DATE(year1,month1,1)
VAR finalDate =
    DATE(year2,month2,28)

RETURN
    CALCULATE (
        MAX ( Mesures_PdG[Termini] ),
        FILTER (
            ALL ( Mesures_PdG ),
            MAX ( Mesures_PdG[Termini] ) <= finalDate
                && MAX (  Mesures_PdG[Termini] ) >= startDate
        )
    )

 Do you think it's correct? Because I put this as a filter of the table and it doesn't work 


Thank you for helping

Hi @Shadowestien ,

 

What does your data model look like and what are the inter-table relationships?

Best Regards,
Henry

 

I got 2 diferent tables for years and months and a relationship with the column on the main table.

Shadowestien_1-1637919857063.png

 

Hi @Shadowestien ,

 

According to your description, you want to filter the corresponding results in Measures_pdg by selecting the date range in Mesos and Anys?


Best Regards,
Henry

 

Yeah, I want to filter the results of the table "Mesures_PDG", specifically the column "Termini" of this table, (it's the DATE column).
By the 4 filters that are (Start_Month & Start_Year) & (Final_Month & Final_Year).
By those 4 filtres i can create Start_Date & Final_Date.

Finally I want to filter "Termini" by the date range between "Start_Date" & "Final_Date"

Hi @Shadowestien ,

 

Delete the relationship between the tables, and then try the following formula to put the value of measure into the filter on this visual to show the result as 1.

vhenrykmstf_0-1638323454309.pngvhenrykmstf_1-1638323477828.pngvhenrykmstf_2-1638323526116.png

If the problem is still not resolved, please point it out or provide test pbix file. Looking forward to your reply.


Best Regards,
Henry


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

kavitabehera
Advocate II
Advocate II

If you want to filter a visual between 2 periods.

For the sake of example let say from 2020 to 2021 only.

 

Go to filter pane, insert date column on either specific visual or entire page to limit it between these 2 days. 

I'm sorry if I didn't understand ur answer, but I don't know what are u telling me to do, because this filter is active on the entire page.
But how the two filters are the same column I can't apply a filtering in "Start Date" and a different one for the "Last Date"

amitchandak
Super User
Super User

@Shadowestien , Not very clear, But these should help

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

 

How to divide/distribute values between start date or end date or count days across months/days: https://community.powerbi.com/t5/Community-Blog/How-to-divide-distribute-values-between-start-date-o...

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

This example doesn't help me because I need it for visual filtering, that the user can change it every moment.

hello , do you find a solution?

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.