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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
DataUser
Helper I
Helper I

How to Allow a User to easily Filter for Any Project between two dates

I've got a report with a lot of projects on it. Each is a line item and has a start/end date. 

 

I want a user to be able to visually change a table so that they select the dates they are looking for and see what projects are going on, and/or ending, and/or starting within that date range. 

 

I think my picture explains it better....2021-04-19_10-02-33.png

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi, @DataUser 

Please check the below picture and the sample pbix file's link down below, whether it is what you are looking for.

the measure is in the sample pbix file.

At this moment, I did not create any relationship between two tables, but if you need it later, you can create an inactive relationship and use USERELATIONSHIP DAX function in a measure.

 

 

Picture3.png

 

https://www.dropbox.com/s/wmhkjkfuhs5n79e/datauser.pbix?dl=0 

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: https://www.linkedin.com/in/jihwankim1975/

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

6 REPLIES 6
DataUser
Helper I
Helper I

Thanks - Taking it a step further, is there a way to make another measure that states the status? Ie: On-Going, Starting, or Ending and applies it to each project within the date range? 

Hi, @DataUser 

 

Thank you for your feedback.

Please try the below measure.

I am not quite sure whether I defined the meaning of Ending / Ongoing / Starting correctly or not.

Please insert the below measure into your visualization and you can try to fix the wordings if I defined those in the other way round.

 

Status flag =
SWITCH (
TRUE (),
SELECTEDVALUE ( Projects[Project Start] ) <= MIN ( dates[Date] )
&& SELECTEDVALUE ( Projects[Project End] ) >= MIN ( dates[Date] ), "Ending",
SELECTEDVALUE ( Projects[Project Start] ) >= MIN ( dates[Date] )
&& SELECTEDVALUE ( Projects[Project End] ) <= MAX ( dates[Date] ), "Ongoing",
SELECTEDVALUE ( Projects[Project Start] ) <= MAX ( dates[Date] )
&& SELECTEDVALUE ( Projects[Project End] ) >= MAX ( dates[Date] ), "Starting"
)

 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Jihwan_Kim
Super User
Super User

Hi, @DataUser 

Please check the below picture and the sample pbix file's link down below, whether it is what you are looking for.

the measure is in the sample pbix file.

At this moment, I did not create any relationship between two tables, but if you need it later, you can create an inactive relationship and use USERELATIONSHIP DAX function in a measure.

 

 

Picture3.png

 

https://www.dropbox.com/s/wmhkjkfuhs5n79e/datauser.pbix?dl=0 

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: https://www.linkedin.com/in/jihwankim1975/

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Lastly - Is there anyway to count the number of times this measure is true? For example, in your example , it would show up as 4? I was trying to use a datacard to do this, but I can't figure out how to count what the measure has returned and I don't want to create another table. 

Hi, @DataUser 

Pleaes check the below picture and the sample pbix file's link down below.

The measure for counting active project is like below.

 

Project Active Count =
CALCULATE (
COUNTROWS(Projects),
FILTER (
Projects,
Projects[Project Start] <= MAX ( dates[Date] )
&& Projects[Project End] >= MIN ( dates[Date] )
)
)
 
Picture1.png
 
 
 
 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

amitchandak
Super User
Super User

@DataUser , You need to join both start and end date to the same date table. One join will be inactive which you can activate using userelationship

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

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.