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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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.

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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