Forum Discussion
DAX
- 6 years ago
Hi RSD ,
We can use the following measure to meet your requirement.
Show Last Month = CALCULATE ( [FYTD Avg Accuracy], 'Table'[date] >= DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ) - 1, 1 ), 'Table'[date] < DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ), 1 ) )If it doesn’t meet your requirement, could you please show the exact expected result based on the table that we have shared?
BTW, pbix as attached.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
RSD , Make sure you use date table for this
YTD QTY forced=
var _max = maxx('Shipmenr + forecast DT',[date].date) //To Stop ytd at max date
return
calculate([shipment Accuracy],DATESYTD('Date'[Date]),'Date'[Date]<=_max)
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/