Forum Discussion
Get the last and previous value
Hi Community,
have this easy one for you but i failed 😞
Have this data
what I need to exrtract is the latest MIN value of rate for the latest Refresh date and Latest -1 (so i can build up a graph that highlights the variation between the two).
I tried with some lastday built in function but it wasn't accurate.
Thanks for your help
Hi abartozzi ,
Create 2 measures as below:
MIN rate for the latest refresh date = var _date=CALCULATE(MAX('Table'[RefreshDate]),ALL('Table')) Return CALCULATE(MIN('Table'[Rate]),FILTER(ALL('Table'),'Table'[RefreshDate]=_date&&'Table'[Checkin]=MAX('Table'[Checkin])))MIN rate for the latest refresh date = var _date=CALCULATE(MAX('Table'[RefreshDate]),ALL('Table')) Return CALCULATE(MIN('Table'[Rate]),FILTER(ALL('Table'),'Table'[RefreshDate]=_date&&'Table'[Checkin]=MAX('Table'[Checkin])))And you will see:(Here I changed the values of the rate on the previous latest date to test the result)
For the related .pbix file,pls see attached.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!
7 Replies
- AllisonKennedy
Community Champion
Can you please paste data as table from Excel or Power BI so we can copy and use easily. Also try to display some desired results so we can compare.
are you looking for the Min value for the previous date? If so, you'll have better luck with a DimDate table: https://excelwithallison.blogspot.com/2020/04/dimdate-what-why-and-how.html
- abartozziFrequent Visitor
Hi Alison,
thank you for your feedback.
I pasted some data here
What I need to get to ultimately would be a bar chart where
x axis is checkin date
y axis is rate
values are a MIN rate for the latest refresh date and the Min rate for the one before the last (clearly 2 different bars).
So I can spot variations.
Thanks
Alberto
- v-kelly-msft
Community Support
Hi abartozzi ,
The link of the data you provided is not public,pls modify it to be public for access.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!