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.
im currently computing for gain/loss in the stock market, and the calendar is not perfect. for example today is monday, and i need to retrieve the data for friday. I am trying to do it in dax with date values, but i only have data for weekdays, nothing on weekends. hope it make sense. Anyone can help please and thanks in advance.
Solved! Go to Solution.
@SinclairFletche
Try this, replace source with the table name you have:
Gain / Loss =
VAR x = 'Historical Data'[DATE]
RETURN
CALCULATE(
MAX('Historical Data'[SOURCE),
FILTER(
ALL('Historical Data'),
'Historical Data'[DATE] < x
)
)
Hi Ray, okay i get the idea, thank you
Gain / Loss =
CALCULATE(
MAX('Calendar'[Date]),
FILTER(
ALL('Historical Data'[DATE]),
'Historical Data'[DATE] < MAX('Calendar'[Date])
)
)
mhmm, im just getting the same date instead of the previous day
what am i doing wrong?
@SinclairFletche
Try this, replace source with the table name you have:
Gain / Loss =
VAR x = 'Historical Data'[DATE]
RETURN
CALCULATE(
MAX('Historical Data'[SOURCE),
FILTER(
ALL('Historical Data'),
'Historical Data'[DATE] < x
)
)
working now. Thanks
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
74 | |
72 | |
39 | |
28 | |
27 |
User | Count |
---|---|
97 | |
97 | |
58 | |
45 | |
42 |