Forum Discussion
Data Import limit based on 3 fields in power query
Hi Power Users,
I'm trying to import some data into power bi and would like to limit the number of records using 3 fields. below is the data looks like.
| Session | Sessionmonth | Sessio Date | Amount |
| S-1 | November | 11/5/2020 | 100 |
| S-2 | November | 11/18/2020 | 100 |
| S-3 | November | 12/4/2020 | 100 |
| Adhoc | November | 12/5/2020 | 100 |
| S-1 | December | 12/8/2020 | 100 |
| S-2 | December | 12/20/2020 | 100 |
| S-1 | January | 1/5/2021 | 100 |
| S-2 | January | 1/20/2021 | 100 |
| S-3 | January | 2/1/2021 | 100 |
By using Session,SessionMonth,SessionDate i would like to load only recent data. For example for November i would like to load Adhoc and for December would like to load S-2 and for january would like to load S-3.
Please help.
Thanks,
3 Replies
- HotChilli
Community Champion
Add a step in Power Query:
Table.SelectRows(#"Changed Type", each (([Sessionmonth] = "November" and [Session] = "Adhoc") or ([Sessionmonth] = "December" and [Session] = "S-2") or ([Sessionmonth] = "January" and [Session] = "S-3")))#"Changed Type" is the name of the previous step
- AnonymousNot applicable
HotChilli Thanks for the reply. session might be change for every month, its not static.
- v-jingzhang
Community Support
Hi Anonymous
To change the session values dynamically, you may want to use the Query Parameters?
Then reference the parameters in Advanced Editor:
#"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([Sessionmonth] = "November" and [Session] = Session1) or ([Sessionmonth] = "December" and [Session] = Session2) or ([Sessionmonth] = "January" and [Session] = Session3))More references:
https://www.biinsight.com/power-bi-desktop-query-parameters-part-1/
Best Regards,
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.