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
Anonymous
Not applicable

[Urgent] [Hard question] [Project Management] Only show relevant values in a range of time

I have two tables (task and date):

 

task table

task table.png

 

Date table

date table.png

 

They do not have relationship between them

relationship.png

 

 

My Virsualization : A matrix which shows the allocation% by person by date.

                Measure: If the date in the range of the task start date and end date, sum the allocation% of the tasks.

              

result.png

 

My problem: When I click the "4%" , it should only show the first line in the table below. Because it is the only line fits that spot. However, it shows all the lines related to "Frank".

 

problemproblem

 

 

Please help me how could it only shows the relevant lines. Thank you!

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi  @Anonymous 

With your data structured as it is, you can create a measure to use as a visual level filter on the table visual.

 

  1. Create this measure:
    Task Date Filter = 
    VAR MinDate =
        MIN ( 'Date'[Date] )
    VAR MaxDate =
        MAX ( 'Date'[Date] )
    RETURN
        CALCULATE ( 
            INT ( NOT ISEMPTY ( task ) ),
            task[startdate] <= MaxDate,
            task[enddate] >= MinDate
        )
    
    This measure effectively applies the date filter from the Date table (defined by min & max date) to the task table, (in the same was as your existing measure does), and returns 1 if there are any rows of task that overlap this date range.
  2. Add Task Date Filter as a visual level filter on the table visual, and set the filter to "Task Date Filter is 1"
  3. Now selecting cells of the matrix visual will filter the table 

Attached PBIX illustrates this - I more-or-less recreated your model with the sample data you posted.

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

View solution in original post

2 REPLIES 2
OwenAuger
Super User
Super User

Hi  @Anonymous 

With your data structured as it is, you can create a measure to use as a visual level filter on the table visual.

 

  1. Create this measure:
    Task Date Filter = 
    VAR MinDate =
        MIN ( 'Date'[Date] )
    VAR MaxDate =
        MAX ( 'Date'[Date] )
    RETURN
        CALCULATE ( 
            INT ( NOT ISEMPTY ( task ) ),
            task[startdate] <= MaxDate,
            task[enddate] >= MinDate
        )
    
    This measure effectively applies the date filter from the Date table (defined by min & max date) to the task table, (in the same was as your existing measure does), and returns 1 if there are any rows of task that overlap this date range.
  2. Add Task Date Filter as a visual level filter on the table visual, and set the filter to "Task Date Filter is 1"
  3. Now selecting cells of the matrix visual will filter the table 

Attached PBIX illustrates this - I more-or-less recreated your model with the sample data you posted.

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn
Anonymous
Not applicable

Hi @OwenAuger ,
I am surprised you solved my question so quickly. I tired on my local file and it works! Thank you so much!

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.