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.
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |