Forum Discussion
Passing Measure output in MQuery
- Anonymous1 year ago
v-dineshya Thanks for checking. We have done it in other way. I will share it once it is done.
Right now it is required we can close this.
Elena_Kalina I have created the table using the below
Update mquery as per your suggestion..
let
// Get the threshold value from the model
ThresholdValue = Text.From(
Value.NativeQuery(
#"Your Previous Step",
"SELECT [CBAM_Value_Parameter Value] AS ThresholdValue"
){0}[ThresholdValue],
"en-US"
),
// Build the dynamic SQL
Source = Sql.Database(
"euwdfas0rssql01.database.windows.net",
"EUWDFAS0RSSDB01",
[Query="
SELECT
HsCode,
SUM(SupplementaryUnitQty) AS TotalSupplementaryUnitQty
FROM
[dbo].[CBAM_Goods_InScope]
WHERE
[EntryIdentifier] IN (
SELECT [EntryIdentifier]
FROM [dbo].[CBAM_Goods_InScope]
GROUP BY [EntryIdentifier]
HAVING SUM([CustomsValue]) > " & ThresholdValue & "
)
GROUP BY
HsCode;"
])
in
Source
The error you're seeing (Expression.Error: The import "Your Previous Step" matches no exports) occurs because the M query is referencing a step name that doesn’t exist in your Power Query Editor.
When adapting my solution, you’ll need to replace #"Your Previous Step" with the actual name of your previous step in the Power Query sequence.
- Anonymous1 year agoNot applicable
Elena_Kalina Yeah got that but there is no previous step in my case..
- Anonymous1 year agoNot applicable
Elena_Kalina Sorry I am not able to understand what exactly you are trying to say. Can you please explain again.