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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
hieptl
Frequent Visitor

Filter ignores the last day of the month that is 31st of the month

Hi, I am trying to filter a data set based on the post_date and post_modified_date. What I did so far was

1. Create a calendar table fromt these two tables as you can see here hieptl_0-1684313885842.png2. Put this into a filter for dates that should filter the visuals based on the selection of the month/year. So when I select fx March 2023 it should take the 1st March 2023 00:00:00 until 31st March 2023 00:00:00  

hieptl_1-1684314039479.png

3. I created a measure that takes into account the start and end date of the selected filter as following 

 

hieptl_2-1684314225774.png

4. I am comparing it to this simple measure countrows of the table with filters on - edited, March, 2023 as you can see here 

hieptl_6-1684316005218.png       

hieptl_0-1684316310358.png

 

 

 

 

5. As you can see here however it ignores the 31st of the month where it stop counting which makes the report inaccurate. The first two columns are post_modified_date and the next 2 are post_date. 

hieptl_3-1684315942955.png

 

My question is what causes the filter to ignore the 31st day and how can I solve this please? Thank you in advance for any help

 

 

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

The problem is that the columns are all datetime not date, so something that happened at e.g. 31/3/2023 13:45 is excluded from the results because it is after 31/3/2023 0:00.

If you don't need the time parts for any other calculations then the simplest thing is to change the types of the columns in both your fact table and date table to be date rather than datetime. For you fact table you will need to change it in both power query and in the modelling view.

If you need to keep the time part for some reason you could amend the definition of EndRange to be MAX('date_filter'[date]) + 1

View solution in original post

2 REPLIES 2
hieptl
Frequent Visitor

jonht75 you are a legend! Thank you 🙂

johnt75
Super User
Super User

The problem is that the columns are all datetime not date, so something that happened at e.g. 31/3/2023 13:45 is excluded from the results because it is after 31/3/2023 0:00.

If you don't need the time parts for any other calculations then the simplest thing is to change the types of the columns in both your fact table and date table to be date rather than datetime. For you fact table you will need to change it in both power query and in the modelling view.

If you need to keep the time part for some reason you could amend the definition of EndRange to be MAX('date_filter'[date]) + 1

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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