Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Afternoon,
Im looking to filter a column [updated_date] (date/time) for the last 2 months or the last 6 months if [type]="ABC"
So all records for the last 6 months where type = "ABC"
and every other record for the last 2 months
thank you!
Solved! Go to Solution.
Hi, @sovereignauto
According to your description, I can clearly understand your requirement, you can try my steps in the Power query:
This is the test data I created:
if Date.IsInPreviousNMonths([Date],2) or Date.IsInCurrentMonth([Date])
then
1
else
if Date.IsInPreviousNMonths([Date],6) and [Type]="ABC"
then 1 else 0
And you can get what you want.
You can download my test pbix file below
If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.
How to Get Your Question Answered Quickly
Thank you very much!
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, If your Source is SQL then You can use "Query Folding" in order to achieve this.
Create a parameter (Parameter_Name) and in the where clause set the condition as follows:
Select * from table_name where the Field_name = Parameter_name
Hi, @sovereignauto
According to your description, I can clearly understand your requirement, you can try my steps in the Power query:
This is the test data I created:
if Date.IsInPreviousNMonths([Date],2) or Date.IsInCurrentMonth([Date])
then
1
else
if Date.IsInPreviousNMonths([Date],6) and [Type]="ABC"
then 1 else 0
And you can get what you want.
You can download my test pbix file below
If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.
How to Get Your Question Answered Quickly
Thank you very much!
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
So i added the Column as you and @amitchandak suggested.
i Guess my issue is that it still syncs over 10m records so guess i need to filter before load into powerbi is that right?
@sovereignauto , Try a new column like and then you can filter
if Date.IsInPreviousNMonths([Date]) && [type]="ABC" then 1 else 0
if need use Date.IsInCurrentMonth
if (Date.IsInPreviousNMonths([Date]) || Date.IsInCurrentMonth([Date]) ) && [type]="ABC" then 1 else 0
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.