Forum Discussion
How to remove/exclude data from query
- 3 years ago
Anonymous ,
Hi,
1 Go to Add Column in top menu.
2 Click on Custom Column
3 Add following code.
Please change [source.name] and [DateColumn] as your table.if [source.name] = "Excel 1 - All" and Date.MonthName( [DateColumn]) = "May" then "True" else
if [source.name] = "Excel 2 - All" and Date.MonthName( [DateColumn]) = "June" then "True" else
if [source.name] = "Excel 3 - All" and Date.MonthName( [DateColumn]) = "July" then "True" else
if [source.name] = "Excel 4 - All" and Date.MonthName( [DateColumn]) = "August" then "True" else "False"Thank you.
- Anonymous3 years ago
Hi Anonymous ,
No, you can update the formula as below:
1. If the year of the data column is equal to 2021
if [source.name] = "Excel 1 - All.xls"
and Date.Year([DateColumn]) = 2021
and Date.MonthName([DateColumn]) = "May"
then "True"
else "False"2. If the year of the data column is equal to the year of current date
if [source.name] = "Excel 1 - All.xls"
and Date.Year([DateColumn]) = Date.Year(DateTime.LocalNow())
and Date.MonthName([DateColumn]) = "May"
then "True"
else "False"Best Regards
Anonymous
Hi,
Your Date column data type should be Date before do this.
1 Select the date column.
2 Click drop down icon in right side ( highlighted in red)
3 Click on Date Filters
4 Click on Between.
5 Select date range you want.
Thank you.
- Anonymous3 years agoNot applicable
However, multiple excels are already combined in the query. So I can see the excels under source.name. So I am trying to clean this up.
Excel 1 - All the days in May, remove all the other dates before and after May.
Excel 2 - All the days in June, remove all the other dates before and after June.
Excel 3 - All the days in July, remove all the other dates before and after July.
Excel 4 - All the days in August, remove all the other dates before and after August.
Should I then import one by one and treat it as different query?- Dinesh_Suranga3 years agoContinued Contributor
Anonymous
Hi,
You can add a new column with two conditions.
If source.name = "Excel 1" - All & Date.MonthName = May then "True" else "False"
Like this. Then you can filter True cells from that column.Switch case will be easy than If funtion.
If you want help to create formula please let me know.
Thank you.
- Anonymous3 years agoNot applicable
Sorry how do u do with switch case?
For if function can provide step by step?
Thanks.