I am struggling to show the correct dates of a measure that represents the value of 12 followed months of the first year registered in the date table, for instance: I have dates registired of 1/2019 until 1/2016, and this measure only calculates values of 2019 until 2018. But when I put this measure and the date column in a single table, the column of the date shows the values of the measure even out of the period I specified in the measure, here is the measure above
Do you mean that you wants to get the values of last 12 months based on registered date, in this scenario, we can create a calendar table using dax(Table 2= Calendar("1/1/2016","12/31/2019")) and then create a measure as below. After that, drag date field of bill table and the measure in a table visual.
LAST12MONTHS = var thisdate = LASTDATE('Table 2'[Date]) var lastyeardate = DATEADD(LASTDATE('Table 2'[Date]),-1,YEAR) return CALCULATE(SUM(Bills[yourfield]), DATESBETWEEN(Bills[Date],lastyeardate,thisdate))
If the above DAX doesn’t help, could you please share the target result to us? You can share some sample data and target result as an example.
Would you mind sharing your PBIX file containing dummy data?