Forum Discussion
Jamey
1 year agoHelper I
Table/Measure Help LASTNONBLANK?
I have a dataset that contains pricing for material, per vendor, and the date range these prices where valid. My goal is to show the price per month and if it changed (price variance). My date slicer...
- 1 year ago
Hi Jamey
To calculate the beginning-of-year price (last valid price before the selected date range) for each vendor and material, you can use the following DAX measure:
Measure to Get the Last Price Before Date Range:
Beginning of Year Price = VAR MinDate = CALCULATE(MIN(Dates[Date]), ALLSELECTED(Dates)) RETURN CALCULATE( MAX(FCI_RAWMAT_PRICE_HIST[PRICE_AMT]), FCI_RAWMAT_PRICE_HIST[BEG_DATE] <= MinDate, FCI_RAWMAT_PRICE_HIST[END_DATE] >= MinDate, REMOVEFILTERS(Dates) -- Ignore any date filters for accurate calculation )- Add this measure to your table or matrix.
- It will display the price valid at the start of the selected date range for each vendor and product.
Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂
Kind Regards,
Poojara
Data Analyst | MSBI Developer | Power BI Consultant
Please Subscribe my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS