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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

My measure is ignoring date filters?

Hello  -  I have a date table.   The date is connected to my "Date Shipped" column in my shipping table.  

 

I have a measure that defines if a shipment is Late or On Time  (ignoring weekends).   The measure works perfectly fine for that purpose, but when I add this measure to my table, it ignores any cross filtering from other visuals.    The visuals here have been filtered down to a week in Februrary....and you can see the difference in the results if the new measure is in the table...and when it is not.    The visual on the right correctly shows the filter context of a specific week in Feb.    

 

Any idea how to change the measure to allow it to "see" the filter context from my other visuals, or even from a slicer?  

 

New AR On Time Late Measure =
VAR _due = SELECTEDVALUE('Flu Shipped'[Due Date])
VAR _shipped = SELECTEDVALUE('Flu Shipped'[Date Shipped])
VAR _datediff = CALCULATE(COUNTROWS(DateTable),FILTER(DateTable,DateTable[Date]>=_due&&DateTable[Date]<=_shipped&&DateTable[Weekday2]<6)) RETURN IF(_datediff<=3,"On Time","Late")

 

 

 

Annotation 2020-02-22 104922.png   New AR Measure.png

 

 

 

 

6 REPLIES 6
v-easonf-msft
Community Support
Community Support

Hi , @Anonymous 

Could you please tell me whether your problem has been solved?
If it is,  please mark the helpful replies or add your reply as Answered to close this thread?

Best Regards,
Community Support Team _ Eason

Greg_Deckler
Community Champion
Community Champion

So generally when I have this problem it is because my measure returns a value for things that I am trying to filter out. Without the measure present in the table, the table is filtered fine but when the measure is present it is returning a value for things that I am trying to filter and thus they get displayed in the table. It's weird and annoying when it happens but it is generally fixeable in your measure. It generally occurs between disconnected tables.

 

The easiest way to fix it is to use a VAR to grab the SELECTEDVALUE in your slicer and then use that in a FILTER of your initial table. So in you might do something like. This simple example is likely not going to work for you overall and all your situations but this should provide the general idea behind it. I am betting your DateTable is a disconnected table and that is why you are in the situation you are in. Let me know if you need further assistance but some sample data would help and description of your relationships.

New AR On Time Late Measure =
VAR _due = SELECTEDVALUE('Flu Shipped'[Due Date])
VAR _shipped = SELECTEDVALUE('Flu Shipped'[Date Shipped])
VAR _datediff = CALCULATE(COUNTROWS(FILTER(DateTable,[Date] = __shipped),FILTER(DateTable,DateTable[Date]>=_due&&DateTable[Date]<=_shipped&&DateTable[Weekday2]<6)) RETURN IF(_datediff<=3,"On Time","Late")

 



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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thanks Greg.   Actually my date table is connect to several other tables, including my shipments table.   Date  to  Date Shipped is the connection.     I will try your revised measure and see how that works, and thanks for the explanation!     The current filter is designed to filter out weekend days  as  I only want to count weekdays.    It works perfectly fine for that...it just is not respecting any other cross filtering.  

 

Annotation 2020-02-22 122649.png

Refer to this. I have created a datediff calendar:https://www.dropbox.com/s/y47ah38sr157l7t/Order_delivery_date_diff.pbix?dl=0

See if this can help

Check for working days

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

Looking at the formula seems like it should ignore some date filters. Can you explain more?

 

From where these date filters coming. Is it coming Date table?

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

Hi Amit   -   I think you are referring to a part of the formula which references another formula, this one: 

 

Weekday2 = WEEKDAY(DateTable[Date],2)
 
This is because I need to only count Late or On Time in the context of weekdays (no weekends should be included in the amount of days between the due date and ship date).
 
 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.