The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello,
I need to apply a filter to a column, so that the results pull any dates in the past, plus the next 3 months. The relative filter works for the 3 month component, however I'm unsure how to also pull anything that is in the past into this list.
Is there a measure that could be written that I can apply as a filter instead of using the relative date?
Thank you
Solved! Go to Solution.
Hi @kristi_in_heels ,
You might want to consider creating a new calculated column by subtracting 3 months from all the dates. Once you have this new column, you can apply a filter to retrieve all records where the new date is prior to today. This way, you will effectively get all the original dates that fall within the past three months.I'v made a test for your reference:
1\ I assume there is a table
2\Add a new caculate column
3\Filter on NewDate
Best Regards,
Bof
Hello @kristi_in_heels ,
Assuming you have a slicers on date , You can use below dax to achieve your purpose :
// Slicer takes a value Date from table Dates
1. If you want relative date as selected date + 90 days , use
Hi @kristi_in_heels ,
You might want to consider creating a new calculated column by subtracting 3 months from all the dates. Once you have this new column, you can apply a filter to retrieve all records where the new date is prior to today. This way, you will effectively get all the original dates that fall within the past three months.I'v made a test for your reference:
1\ I assume there is a table
2\Add a new caculate column
3\Filter on NewDate
Best Regards,
Bof
Hi @kristi_in_heels ,
Yes. You could adjust the date range according to your specific needs. In the screenshot I provided, the time range is set to include data from the past 10 years.
Best Regards,
Bof
Thanks so much.
Would you be able to assist me in tweaking this measure so I can use it to apply a conditional format?
Currently, I use this to highlight anything in "FS" phase, but I need the highlight to apply to that same condition for anything in "FS", "PFS" or "CON".
Are you looking for a solution in PowerQuery (M) or in PowerBI (DAX)?
Power query actually does have a filter for "In the next"... from which you can set to 3 months. Right click on the column, and you should see it. I don't remember off the top of my head whether those 3 months are months or calendar months, but you should be able to easily tweak the formula (i.e by using days)
If you're after a DAX solution, I would recommend one of two ways -
the first would be to not use a calculated column unless absolutely necessary. Instead, consider using calculate functions such as DATESBETWEEN(), DATESINPERIOD() etc... to filter out the dates as needed.
If you absolutely need to use a calculated column, then something like:
Flag in Past or next 3 Months = INT(Table[Date] <= EOMONTH(TODAY(), 3))
note that EOMONTH will give you the end of the calendar month, so again, please tweak as needed.
Hope this is helpful
Thank you.
I am already using the filter for the next 3 months, but this cuts off anything that is noted as before today's date.
What I want to see is anything within this filter, PLUS anything that has a date showing prior to today, so we can see items which haven't hit the target date.