This Year vs Last Year


#1

Hello Sam, I hope all is well with you.

Let me know if you can help me with a matrix that I am trying to build.

In my model there are 2 Tables: Sales and Dates

Sales from Jan 2017 to Nov 2018. So there is no data for dec 2018.

Below you will see the matrix that I am trying to build:

image

And below it is the one that I got with Dax basic formulas:

image

As you can see I do not want to consider data from December 2017.

Any help would be very appreciated.

Best Regards
Jose Ricardo


#2

Thanks for your patience.

Check out the technique discussed in the below forum post.

This is exactly how I would solve this so that you only show what you require in your Power BI report page.


#3

Thanks Sam!

It works nicely!

I just created a calculated column in Dates Table
=CALCULATE(MONTH(MAX(Sales[Date]));
FILTER(Sales;
not ISBLANK(Sales[Amount])))>=Dates[MonthNumber]

and Sales measure
CALCULATE(SUM(Sales[Amount]);FILTER(Dates;Dates[IsMonthValid?] = TRUE()))

Best Regards