Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I would like to make a visual of top 10 stocks differences, but with variable return horizon(ie, price_today - price 2 days before, or price_today - price n days before) where n is given by a measure and can be changed in a hover.
The problem is, my data has only three columns and looks like that (example for 2 symbols)
symbol | date | close |
T1 | 16/10/2022 | 100 |
T2 | 16/10/2022 | 95 |
T1 | 15/10/2022 | 98 |
T2 | 15/10/2022 | 90 |
T1 | 14/10/2022 | 30 |
T2 | 14/10/2022 | 40 |
In this case i could change a hover and get 1-day diference (setting hover to 1), 2-day diference(setting hover to 2) ...
Solved! Go to Solution.
Hi, @Anonymous
You can try the following methods.
Measure:
price n day =
VAR _N = SELECTEDVALUE ( 'Table'[date] ) - 1
RETURN
CALCULATE (SUM ( 'Table'[close] ),
FILTER (ALL ( 'Table' ),
[symbol] = SELECTEDVALUE ( 'Table'[symbol] )
&& [date] = _N ) )
Difference = IF([price n day]=BLANK(),0,SUM('Table'[close])-[price n day])
Change 1 to 2 to get the difference from the previous 2 days.
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi, @Anonymous
You can try the following methods.
Measure:
price n day =
VAR _N = SELECTEDVALUE ( 'Table'[date] ) - 1
RETURN
CALCULATE (SUM ( 'Table'[close] ),
FILTER (ALL ( 'Table' ),
[symbol] = SELECTEDVALUE ( 'Table'[symbol] )
&& [date] = _N ) )
Difference = IF([price n day]=BLANK(),0,SUM('Table'[close])-[price n day])
Change 1 to 2 to get the difference from the previous 2 days.
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
72 | |
70 | |
37 | |
29 | |
26 |
User | Count |
---|---|
91 | |
49 | |
45 | |
38 | |
37 |