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
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
thank you Anonymous and Dinesh_Suranga. Both lifesavers! have a good one. take care