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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
lukasjar
Resolver I
Resolver I

Manual Query, if no match = other

Hello community.

I have two different sources with [location] and [location2] with different amount of distinct values that i add in a relationship in MachineId. As you can see below there are just two matches to my excel file data (MachineId) and a large difference in DistinctCount.

1. What I would like is to write a own Query in QueryEditor that places the values that dont have a match on Location/Location2 with MachnieId into "Others". 182-15 = 167 Location should be put in 1 position called Others. I can, if necessery remove my "MachineId" file and write the MachineId in the Query as well.
image.png

 

 

 

 


2. When I add location and location2 in the same table in Power BI Desktop it results in an error. I do not understand why this is happening. Here are the relationships, via Machnie Id.
image.png

4 REPLIES 4
artemus
Microsoft Employee
Microsoft Employee

Do Merge Queries as New using ScrapData and MachineId (in that order). Choose Join type as Left Anti. You can remove the join column. Remove all columns except location. Then repeat this for your other table. Finally Do a combine tables on these two, followed by a distinct.

 

The combined table is done in the same way being: Merge new query, Left Anti and remove all columns but Location?

And how is the distinct done?

 

artemus
Microsoft Employee
Microsoft Employee

1. Yes, remove all columns but location.

 

2. Click the column and choose: Remove Rows -> Duplicates

I did not get it to work that way. However I tried doing it this way and got it to work at this time.

 

1. Renamed column Location2 in MachineHours to Location

2. New Append queries on ScrapData and MachineHours

3. Removed other columns then Location in the new Appended Query.

4. Removed duplicates on the new Appeneded query Location.

5. Can now link ScrapData, MachineHours and MachineId to the new Table.

 

One issue remains doing it this way is that I have not automated renaming or adding a column with same name or for all of the Locations that are not in my MachineId table as "Other".

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.