Forum Discussion
tomas12344
Helper III
2 years agoConditionally invoke function or run statement
Hi All Customer want to load some data from SAP query, but the problem is, that in this case I have to call several times this query with different filters (basic probelm is that the query in SAP ha...
- 2 years ago
Hello tomas12344,
I'm not sure if I understood you correctly. But maybe the following code will help you.let LoadSAPData = (FilterParameter as text) as table => let Source = ... , // YOUR SAP QUERY FilteredData = if FilterParameter = "FA" then Table.SelectRows(Source, each [YearColumn] = 2020) else if FilterParameter = "FB" then Table.SelectRows(Source, each [YearColumn] = 2021) else Source in FilteredData in LoadSAPData
Best regards from Germany
Manuel Bolz
If this post helped you, please consider Accept as Solution so other members can find it faster.
🤝Follow me on LinkedIn
ManuelBolz
Responsive Resident
2 years agoHello tomas12344,
I'm not sure if I understood you correctly. But maybe the following code will help you.
let
LoadSAPData = (FilterParameter as text) as table =>
let
Source = ... , // YOUR SAP QUERY
FilteredData = if FilterParameter = "FA" then
Table.SelectRows(Source, each [YearColumn] = 2020)
else if FilterParameter = "FB" then
Table.SelectRows(Source, each [YearColumn] = 2021)
else
Source
in
FilteredData
in
LoadSAPData
Best regards from Germany
Manuel Bolz
If this post helped you, please consider Accept as Solution so other members can find it faster.
🤝Follow me on LinkedIn