ggv
ggv

Reputation: 109

How to build measure on query field in power bi

I have a query that extracts data from an SQL database by using direct SQL statement like

SELECT Product, Quantity, Amount FROM Sales;

I need to build a measure that calculates Quantity * Amount, but when I try typing it in, it does not allow me to use fields from the query. Is this not possible in Power BI?

Upvotes: 0

Views: 180

Answers (1)

teylyn
teylyn

Reputation: 35970

What you describe is a calculated column, not a Measure. Use the Power Query with the SQL statement to load the column for Product, Quantity and Amount. In the Query Editor add a custom column with the formula

=[Quantity]*[Amount]

Then use a measure to total that calculated column and when you use the measure in a pivot or another Power BI visualisation, it will show only the results for the values that are included in the current filter.

Upvotes: 1

Related Questions