Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
Can you tell me what is wrong with this measure? I want the table to show sales for the last 5 months from today:
Solved! Go to Solution.
Hi @sw123 ,
You can try
CALCULATE(SUM(F_Invoice[Sales]),DATESBETWEEN(F_Invoice[Invoicedate],EDATE(EOMONTH(TODAY(),-1)+1,-5),EOMONTH(TODAY(),-1)+1))
or
Try using MAX instead of LASTDATE
Hi @sw123 ,
You can try
CALCULATE(SUM(F_Invoice[Sales]),DATESBETWEEN(F_Invoice[Invoicedate],EDATE(EOMONTH(TODAY(),-1)+1,-5),EOMONTH(TODAY(),-1)+1))
or
Try using MAX instead of LASTDATE
Thanx, still not working, though 😞
Now I read you blog more carefully and used the last updated simpler formula and it worked! Great thanx!
You can try:
Sales Period = CALCULATE(
SUM(F_Invoice[Sales]);all(F_Invoice[Invoicedate]);
DATESINPERIOD(F_Invoice[Invoicedate];
LASTDATE(F_Invoice[Invoicedate]);
-5;MONTH))
Proud to be a Super User!
Awesome Keyboard Shortcusts in Power BI, thumbs up if you like the article
My Community Blog Articles (check them out!)
My Blog - Power M code to automatically detect column types -
How to create test data using DAX!
Thanx, but it is still not working as it should 😞
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 16 | |
| 8 | |
| 4 | |
| 4 | |
| 3 |
| User | Count |
|---|---|
| 25 | |
| 13 | |
| 12 | |
| 10 | |
| 5 |