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
HxH
Helper II
Helper II

Moving range of date as a filter

Hi, 
I would like to create a calculated column in a date table which would return TRUE if the day of the corresponding row is after the last 25th day and FALSE otherwise

To put it in a more clear way: 
-if it's the 26th of the current month, it must compute true just for the 26th
-if it's the 24th of the current month, it must compute true for all the days between 25th of last month and today 

Basically I want a moving window that goes from the last 25th day up to today, and I will use it later as a filter on a visual to always have data that starts from the last 25th day. What it does is basically the same as setting the filter on a visual as "date is after the 25th of..." and changing the month every 25th manually. Is it possible to do it dynamically using a calculated column? 

Thanks

 

1 ACCEPTED SOLUTION
v-xicai
Community Support
Community Support

Hi @HxH ,

 

You may create column like DAX below.

 

Date is after the 25th of last month=IF(Table[Date]>DATE(YEAR(TODAY()), MONTH(TODAY())-1, 25 ), "TRUE","FALSE")

If I misunderstood it, could you please share your sample data and desired output screenshots for further analysis? You can also upload sample pbix to OneDrive and post the link here. Do mask sensitive data before uploading.

 

Best Regards,

Amy

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
v-xicai
Community Support
Community Support

Hi @HxH ,

 

You may create column like DAX below.

 

Date is after the 25th of last month=IF(Table[Date]>DATE(YEAR(TODAY()), MONTH(TODAY())-1, 25 ), "TRUE","FALSE")

If I misunderstood it, could you please share your sample data and desired output screenshots for further analysis? You can also upload sample pbix to OneDrive and post the link here. Do mask sensitive data before uploading.

 

Best Regards,

Amy

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

It seems to be working, I added a && Date[Date]<today() ) in the IF condition in order to only get that moving window of days and not also future dates considered. 

I am only worried about what will happen at the 26th of this month, since it seems to me that this code will return the 25th of last month (and when I'm at the 26th of a month I only want one day to be TRUE, the 26), but I am probably misinterpreting the code. I'll accept as solution and thanks for your kind help. 

Regarding data sample, I wanted to compute this on a standard date table, so I don't think sample data is needed if you need to make further considerations. Thanks again. 

After reading it again I am more convinced that this code will always return TRUE for all the days since the 25th of last month. It works fine now, as I'm at the 13th of september. But when I'm at the 26th of September I want the code to consider only that day as TRUE. I would like a moving window that starts from every last 25th, not from the 25th of last month. I don't know if I explained myself in a clear way, anyway I'll try to work around your code to make it work as I intend and post it if I succeed. Thanks again

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.