Forum Discussion
Filter date based on other table
- 1 year ago
Hi HuyNguyenn,
Thank you for reaching out to Microsoft Fabric Community.
Thank you Deku for the prompt response.
To filter the Main Table based on the EndOfMonth Table follow below steps:
- Add a Year column to the EndOfMonth table and sort the EndOfMonth table by Year (Descending) and EndOfMonth (Descending).
- Group by Year, then add an Index Column that starts from 1 inside each year.
- Filter the table to keep only as Index = 1 (End of the current month), Index = 2 (End of last month), for March 31 of last year, use Date.Month([EndOfMonth]) = 3 and Date.Day([EndOfMonth]) = 31
- Merge the filtered EndOfMonth table with the Main Table like by matching TransDate to EndOfMonth.
This will filter the Main Table to show only the required end-of-month dates.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thanks and regards,
Anjan Kumar Chippa
If you go to your first table, go to the ribbon and select merge and perform a left semi join between the date columns. This will filter the first table to those dates from the second, without returning fields from the second table.
To pre filter the second table, before the join, add a index from the ribbon. If you filter the index to 1,2 and 13 this should return this month, last month, and this month last year.
- HuyNguyenn1 year agoNew Member
Dear Deku,
Thanks for your prompt reply.
I have added the Index, but when filter, I get 2017 and 2018 data
Sorry as I'm new to PBI
- v-achippa1 year agoCommunity Support
Hi HuyNguyenn,
Thank you for reaching out to Microsoft Fabric Community.
Thank you Deku for the prompt response.
To filter the Main Table based on the EndOfMonth Table follow below steps:
- Add a Year column to the EndOfMonth table and sort the EndOfMonth table by Year (Descending) and EndOfMonth (Descending).
- Group by Year, then add an Index Column that starts from 1 inside each year.
- Filter the table to keep only as Index = 1 (End of the current month), Index = 2 (End of last month), for March 31 of last year, use Date.Month([EndOfMonth]) = 3 and Date.Day([EndOfMonth]) = 31
- Merge the filtered EndOfMonth table with the Main Table like by matching TransDate to EndOfMonth.
This will filter the Main Table to show only the required end-of-month dates.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thanks and regards,
Anjan Kumar Chippa
- v-achippa1 year agoCommunity Support
Hi HuyNguyenn,
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution I have provided for the issue worked? or let us know if you need any further assistance.
If my response addressed, please mark it as "Accept as solution" and click "Yes" if you found it helpful.Thanks and regards,
Anjan Kumar Chippa