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
DouweMeer
Post Prodigy
Post Prodigy

Query that doesn't work

It's probably just me... but my query isn't working. It tell me that 'G_EF.mximpl' is invalid.

 

Select
G.line_item_id
, G.price
, G_EF.mximpl
FROM
mn_price_master_li G
inner join
(
SELECT
max ( G_ED.date_impl ) as "mximpl"
, max ( G_ED.eff_start_date ) as "mxeff"
, G_ED.line_item_id as "Id"
FROM
mn_price_master_li G_ED
WHERE
G_ED.line_item_id = '6314925' OR G_ED.line_item_id = '908200'
GROUP BY
G_ED.line_item_id
) G_EF
ON
G.line_item_id = G_EF.id
and G.date_impl = G_EF.mximpl
and G.eff_start_date = G_EF.mxeff

 

But when I do the following, it does return a table with 3 columns as specified with the select statement in the from part...

SELECT

G_EF.*

FROM

(
SELECT
max ( G_ED.date_impl ) as "mximpl"
, max ( G_ED.eff_start_date ) as "mxeff"
, G_ED.line_item_id as "Id"
FROM
mn_price_master_li G_ED
WHERE
G_ED.line_item_id = '6314925' OR G_ED.line_item_id = '908200'
GROUP BY
G_ED.line_item_id
) G_EF

 

1 ACCEPTED SOLUTION

So, I've found the problem.  

["mximpl"] is not matching with [G_EF.mximpl], it is supposed to be [G_EF."mximpl"] to make it work. 

Silly flaw :). 

 

View solution in original post

5 REPLIES 5
danextian
Super User
Super User

Care to post a screenshot?










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Small:

Small query with only G_EFSmall query with only G_EF

Result of small:

Result of small query with only G_EFResult of small query with only G_EF

Attempt on longer one

Long:

Larger query merging G_EF with G.Larger query merging G_EF with G.

Hi @DouweMeer ,

 

Please run the SQL command in your database firstly to check if it will return the correct result. And please check if there is any special character in the G_EF.maxeff column.

 

 

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

So, I've found the problem.  

["mximpl"] is not matching with [G_EF.mximpl], it is supposed to be [G_EF."mximpl"] to make it work. 

Silly flaw :). 

 

drorli
Helper I
Helper I

Are you sure you posted this question in the right forum?

This looks like SQL and not PowerQuery to me ...

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