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
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.

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

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
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.