Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I have the below data with trade, stock and price column where the output price column should be
If Trade= "BUY" then Price corresponding to BUY
Else if Trade= "SELL" then Price corresponding to BUY in all sell rows
So basically the output for all the trades should be the Price for BUY trade i.e. 2000 in our example
Solved! Go to Solution.
hi @Harshc374
If you need it as a Calculated Column. In case there are multiple BUY, it will take MAX of that price, you can modify as per your requirement.
hi @Harshc374
If you need it as a Calculated Column. In case there are multiple BUY, it will take MAX of that price, you can modify as per your requirement.
Hi @Harshc374
For your question, here is the method I provided:
Here's some dummy data
"Table"
Create a measure. Query the Price of Trade="BUY", and when Trade="SELL", output the Price of BUY.
Output Price =
VAR BUY_Price =
CALCULATE(
VALUES('Table'[Price]),
FILTER(
ALL('Table'),
'Table'[Stock] = MAX('Table'[Stock])
&&
'Table'[Trade] = "BUY"
)
)
RETURN
IF(
SELECTEDVALUE('Table'[Trade]) = "BUY",
VALUES('Table'[Price]),
BUY_Price
)
Here is the result.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
8 | |
8 | |
7 |
User | Count |
---|---|
14 | |
12 | |
11 | |
10 | |
8 |