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.
Hi all,
I want to calculate the daily return for this stock price (ignoring the weekend) by creating a new measure. May I know how should I do that by using DAX formula? I'm quite new to PowerBI. Thank you.
Solved! Go to Solution.
Here is one way to do it. Use this measure expression in a table visual with the date column from your stock table. Replace Stock with your actual table name.
Change From Prev Day =
VAR thisvalue =
MAX ( Stock[Close] )
VAR thisdate =
MAX ( Stock[Date] )
VAR prevvalue =
CALCULATE (
LASTNONBLANKVALUE (
Stock[Date],
MAX ( Stock[Close] )
),
FILTER (
ALL ( Stock[Date] ),
Stock[Date] < thisdate
)
)
RETURN
DIVIDE (
thisvalue - prevvalue,
prevvalue
)
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Here is one way to do it. Use this measure expression in a table visual with the date column from your stock table. Replace Stock with your actual table name.
Change From Prev Day =
VAR thisvalue =
MAX ( Stock[Close] )
VAR thisdate =
MAX ( Stock[Date] )
VAR prevvalue =
CALCULATE (
LASTNONBLANKVALUE (
Stock[Date],
MAX ( Stock[Close] )
),
FILTER (
ALL ( Stock[Date] ),
Stock[Date] < thisdate
)
)
RETURN
DIVIDE (
thisvalue - prevvalue,
prevvalue
)
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
@mahoneypat Similar thing I need to do for Weekly and Monthly as well. Can you please help it is little urgent.
https://community.powerbi.com/t5/Desktop/stock-gainers-and-losers/td-p/3160077
@Greg_Deckler Can you please help me here?
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 | |
7 | |
6 |
User | Count |
---|---|
14 | |
13 | |
11 | |
9 | |
8 |