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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
PaulChap
Regular Visitor

Filtering a value that is a measure within two dates that differs per value

I have made up some data so it is easier for me to explain this.

 

NameCount(measure)Date BeforeDate After
A101/1/20205/5/2020
B211/5/20225/5/2022
C253/4/20191/1/2020
    

 

I want to be able to filter the count table between date before and date after. I can put a silcer and get the count value but that would have to be done 1 by 1 and it would not be automatic when new data comes in. The count table is a measure which is what is causing me trouble. If count was not a measure I would be able to use a simple filter function. How would I write a DAX function that would allow me to filter the Values(measure) between the Date Before and Date After?

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @PaulChap 

 

You can try the following methods.
New Table:

Date = CALENDAR(MIN('Table'[Date Before]),MAX('Table'[Date After]))

Measure:

Measure =
CALCULATE (
    [Count],
    FILTER (
        ALL ( 'Table' ),
        [Date Before] >= MIN ( 'Date'[Date] )
            && [Date After] <= MAX ( 'Date'[Date] )
            && [Name] = SELECTEDVALUE ( 'Table'[Name] )
    )
)

The date slicer selects the relative mode.

vzhangti_0-1666591057382.pngvzhangti_1-1666591080976.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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-zhangti
Community Support
Community Support

Hi, @PaulChap 

 

You can try the following methods.
New Table:

Date = CALENDAR(MIN('Table'[Date Before]),MAX('Table'[Date After]))

Measure:

Measure =
CALCULATE (
    [Count],
    FILTER (
        ALL ( 'Table' ),
        [Date Before] >= MIN ( 'Date'[Date] )
            && [Date After] <= MAX ( 'Date'[Date] )
            && [Name] = SELECTEDVALUE ( 'Table'[Name] )
    )
)

The date slicer selects the relative mode.

vzhangti_0-1666591057382.pngvzhangti_1-1666591080976.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

amitchandak
Super User
Super User

@PaulChap , Not very clear, are you getting value from another table.

 

refer if these can help

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

 

Power BI Dax Measure- Allocate data between Range: https://youtu.be/O653vwLTUzM
https://community.powerbi.com/t5/Community-Blog/How-to-divide-distribute-values-between-start-date-o...

 

The information you have provided is not making the problem clear to me. Can you please explain with an example.

Appreciate your Kudos.

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.