Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
tundra
Regular Visitor

How to compare cell values in a table with column from another table to find unmatched values?

I'm using a table from Sharepoint list which stores documents uploaded for each month. Months are stored as 21-12-December, 22-01-January and so on. Say the year starts from 21-08-August and ends at 22-07-July and 10 branches upload a file for each month that has passed.

 

My report at the moment has a slicer to select the branch. When I select 01-Alpha branch in the slicer, I want a list that shows the months remaining for the branch like 21-11-November, 21-12-December, 22-01-January and so on. If I have table with a months list from 21-08-August to 22-07-July, how do I compare entries for each branch to find which months remain?

 

Here's how my data looks.

att1.png

att2.png

1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @tundra ,

 

If you want to implement it in PQ, please create a new query and paste the following code.

let
    Source = Table.SelectColumns(records,{"branch"}),
    #"Removed Duplicates" = Table.Distinct(Source),
    #"Added Custom" = Table.AddColumn(#"Removed Duplicates", "RecordsMonthsList", each let 
   myfunction = (Currentbranch) => 
     let 
       SelectRows = Table.SelectRows(records, each [branch] = Currentbranch) 
     in 
       SelectRows,
   ListData = myfunction([branch])[#"month-of"]
in 
 ListData),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "unmatched months", each List.RemoveMatchingItems(months[#"months list"],[RecordsMonthsList])),
    #"Expanded unmatched months" = Table.ExpandListColumn(#"Added Custom1", "unmatched months"),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded unmatched months",{"RecordsMonthsList"})
in
    #"Removed Columns"

vkkfmsft_1-1652064884667.png


If you want to implement it in DAX, please create the following inter-table relationship and measure, and use the measure as a visual level filter.

 

vkkfmsft_2-1652065378776.png

Measure = 
COUNTROWS (
    FILTER ( months, NOT months[months list] IN VALUES ( records[month-of] ) )
)

vkkfmsft_3-1652065436221.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-kkf-msft
Community Support
Community Support

Hi @tundra ,

 

If you want to implement it in PQ, please create a new query and paste the following code.

let
    Source = Table.SelectColumns(records,{"branch"}),
    #"Removed Duplicates" = Table.Distinct(Source),
    #"Added Custom" = Table.AddColumn(#"Removed Duplicates", "RecordsMonthsList", each let 
   myfunction = (Currentbranch) => 
     let 
       SelectRows = Table.SelectRows(records, each [branch] = Currentbranch) 
     in 
       SelectRows,
   ListData = myfunction([branch])[#"month-of"]
in 
 ListData),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "unmatched months", each List.RemoveMatchingItems(months[#"months list"],[RecordsMonthsList])),
    #"Expanded unmatched months" = Table.ExpandListColumn(#"Added Custom1", "unmatched months"),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded unmatched months",{"RecordsMonthsList"})
in
    #"Removed Columns"

vkkfmsft_1-1652064884667.png


If you want to implement it in DAX, please create the following inter-table relationship and measure, and use the measure as a visual level filter.

 

vkkfmsft_2-1652065378776.png

Measure = 
COUNTROWS (
    FILTER ( months, NOT months[months list] IN VALUES ( records[month-of] ) )
)

vkkfmsft_3-1652065436221.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Used the DAX measure filter. It worked!
Many thanks! You're a lifesaver.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.