Forum Discussion
Current and Previous based on timestamp
Hi frinds,
I have below fields
| Product | Amount | Date_Time |
| A | 10 | 6/23/20 12:10:10 |
| B | 20 | 6/23/20 12:10:10 |
| C | 30 | 6/23/20 12:10:20 |
| D | 40 | 6/23/20 12:40:30 |
| A | 40 | 6/22/20 12:10:50 |
| B | 120 | 6/22/20 12:00:24 |
| C | 60 | 6/22/20 12:00:10 |
| D | 100 | 6/22/20 12:10:00 |
Based on the Time Stamp how to calculate current and Previous amount for the Products dynamically.
| C | 30 | 6/23/20 12:10:20 |
| D | 40 | 6/23/20 12:40:30 |
Product D should be the Current and Product C should be previous. Please help how to calculate dynamically.
Please help
Thanks & Regards,
BhavyaM , create descending column rank on datetime and filter for 2.
For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/367415
2 Replies
- amitchandakSuper User
BhavyaM , create descending column rank on datetime and filter for 2.
For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/367415- BhavyaMHelper V
Thanks it worked 👍