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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
stephenstill
New Member

Row_Number() works in SMSS, but creates two rows when the data comes into Power BI

I use the following in smss:

Select Row_Number() over(partition by .Location,SKU order by Location,SKU) as RN. In SMSS I get one row per SKU by location,

 

but when I use the exact same query in Power BI (import data) then for some items only in some locations, it creates a second row for the same sku and location combination when some of the other columns have different values. Is this a bug? IS there a way to merge the two rows when they have the same location and sku?

3 REPLIES 3
stephenstill
New Member

That is why I wonder if there is a bug-I copied and pasted my SMSS query into the get data from azure query box, and as soon as it loads, I have two rows in the data table in Power BI where I only had one row in SMSS.

 

I'm not convinced it's a bug to be honest but, unfortunately, it's impossible for me to recreate your scenario without access to your data source(s) etc. which obviously isn't possible.

That being said, I'm wondering whether you have trailing/leading whitespace on your values that SSMS ignores in the output, but that Power Query wouldn't ignore. Maybe try using LTRIM(RTRIM(...)) around [Location] and [SKU] in your SQL? It's probably a long-shot, but worth a try.

 

If you're sure it's not something locally that's causing the issue then you can raise a support ticket with MS :

https://powerbi.microsoft.com/en-us/support/free/ 

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




BA_Pete
Super User
Super User

Hi @stephenstill ,

 

Highly unlikely this is a bug in PQ.

If you use the native query method of importing data, PQ just shows the data that the server returns, exactly the same as SSMS does.

There might be ways to merge the rows but I'd not recommend doing that. You really need to identify what the actual issue is and resolve that in order to maintain data integrity.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors