Calculate Sales with respect to the previous Month.
I am working with a sales base that contains all the sales of an eccommerce, this one is already worked previously and then uploaded to Power Bi.
What I want to do is two data cards, where it shows me the cumulative sales of the month and the cumulative sales of the day. To complement I want these to be colored green, if the cumulative sale of the month is greater than last month and if the sale of today is greater than the sale of the same day but last month, otherwise it is in red.
I am using the following measures
Ventas Totales = SUM(Tabla[Ventas])
Ventas Mes Anterior =
KPI MES = SWITCH(
[Ventas Totales] < [Ventas Mes Anterior] , "#ff0000",
[Ventas Totales] > [Ventas Mes Anterior] , "#009900",
Ventas Dia y Mes Anterior = CALCULATE([Ventas Totales],
KPI DIAS= SWITCH(
[Ventas Totales] < [Ventas Dia y Mes Anterior] , "#ff0000",
[Ventas Totales] > [Ventas Dia y Mes Anterior] , "#009900",
When formatting a card object, it works as I want it to, but the problem is when I add a filter object that contains the categories of the products sold (Shirts, Pants, Jackets, etc.). When selecting a category to filter all the objects, they do not behave as they should (In the image the months with yellow color should be green and not Red).
If someone could help me with the right measurement so that when filtering I do the calculation well, I would appreciate them.