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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Julian1
Microsoft Employee
Microsoft Employee

Adjusting output of the filter to capture time ranges that overlap it

I'm currently working on a project to capture how much time people spend in meetings during the day. 

 

As an example, I've created the following table visualization showing my meetings for the day:

Hugepickle_0-1599060823200.png

If I want to know about meeting time spent during the workday, I'd use a filter for my working hours of 9am-5pm:

Hugepickle_1-1599061128949.png

 

The problem is that this cuts off the first meeting in the list that goes from 8:30am-9:15am, since it started before the CollaborationStartTime. However, since the meeting ran into my working hours, I want it to show up in the list of meetings for that day. 

 

I understand that the filter is working as intended in this case. However, when I use a filter like this I wanted to show any appointment that in any way overlapped my 9am-5pm working hours, even if it started before or ended after that time range. Is this possible?

 

I've spent a few hours trying to figure this out and unfortunately haven't had much success. I'm new to DAX and PowerBI ( though learning a lot 🙂 and would welcome any thoughts.

 

 

1 ACCEPTED SOLUTION

@Julian1 - Sorry, "Selector" is a measure, not a calculated column. You would add it into the Filter pane at the visualization level for you table visual or whatever visual you are using.

 

I guess you could make it a calculated column pretty easily though now that I think about it.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@Julian1 , a flag like

new column = if(([collbration End time] >= time(9:00:00) && [collbration Start time] <=time(17:00:00)),1,0)

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
Greg_Deckler
Super User
Super User

@Julian1 - Hello again. So, I generally use what I call a Complex Selector for this. https://community.powerbi.com/t5/Quick-Measures-Gallery/The-Complex-Selector/m-p/1116633#M534

 

Essentially, you implement whatever logic you want and return a 1 or 0 and then filter on that. In your case it might be:

Selector =
  SWITCH(TRUE(),
    [End] > [WorkingStart] && [End] < [WorkingEnd],1,
    [Start] < [WorkingEnd] && [Start] > [WorkingStart],1,
    [Start] > [WorkingStart] && [End] < [WorkingEnd],1,
    0
  )

You may need different logic.

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Thanks, Greg. Would "Select" in this case by a Calculated column on the table with my meeting data? If so, how do I get the DAX query to use the value selected in my filter? That's the part I've been struggling with.

 

It looks like "WorkingStart" and "Working End" would use the values provided by the filter shown in my screenshot above, just not sure how to make that work. 

 

I read your link and didn't get how to do that, perhaps just because I'm so new to this. 

@Julian1 - Sorry, "Selector" is a measure, not a calculated column. You would add it into the Filter pane at the visualization level for you table visual or whatever visual you are using.

 

I guess you could make it a calculated column pretty easily though now that I think about it.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Thanks, Greg, this really helped. It took a while for me to figure it out but I got it to work.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.