Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
miguealejandror
New Member

Matriz no muestra datos que no esten la categoria principal.

Estoy haciendo un reporte en PBI donde muestro datos actuales vs mes anterior vs año anterior. Para una mejor visualizacion estoy usando Categorias en una matriz. Para poder mostrar todas las categorias aunque no contengan datos cree una tabla con las categorias. La tabla se llama Categorias[Categorias]. Arrastre este campo a la matriz en mis filas y para calcular los conteos de mes anterior utilice esta formula: 
MesAnterior = CALCULATE(
SUM(Consulta[CONTEO MES ACTUAL]),
PREVIOUSMONTH(Consulta[FECHA]),
REMOVEFILTERS(Consulta),
VALUES(Categorias)
)
El total que me regresa es correcto (lo verifique en la base de datos) pero a la hora de distribuirlo por categoria en la matriz. El patron que observo es que solo me muestra datos en la matriz que esten presente en el Actual.

miguealejandror_0-1737470178253.png

El total que es 43 esta bien, pero 39 + 3 es 42. Lo que Significa que hay una categoria que no se esta mostrando para el mes anterior.

 

1 ACCEPTED SOLUTION
v-cgao-msft
Community Support
Community Support

Hi @miguealejandror ,

 

PREVIOUSMONTH as a time-intelligence function, please give preference to referencing the argument from the calendar table. Refer to the following Note subsection.

PREVIOUSMONTH - DAX Guide

Please try:

PreviousMonth = 
CALCULATE(
SUM(Consulta[CONTEO MES ACTUAL]),
PREVIOUSMONTH('Date'[Date]),
REMOVEFILTERS(Consulta),
VALUES('Categorias'[category])
)

About month-related calculations calendar table:

Month-related calculations – DAX Patterns

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

3 REPLIES 3
v-cgao-msft
Community Support
Community Support

Hi @miguealejandror ,

 

PREVIOUSMONTH as a time-intelligence function, please give preference to referencing the argument from the calendar table. Refer to the following Note subsection.

PREVIOUSMONTH - DAX Guide

Please try:

PreviousMonth = 
CALCULATE(
SUM(Consulta[CONTEO MES ACTUAL]),
PREVIOUSMONTH('Date'[Date]),
REMOVEFILTERS(Consulta),
VALUES('Categorias'[category])
)

About month-related calculations calendar table:

Month-related calculations – DAX Patterns

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

bhanu_gautam
Super User
Super User

@miguealejandror , Try using 

 

PreviousMonth = CALCULATE(
SUM(Query[CURRENT MONTH COUNT]),
PREVIOUSMONTH(Query[DATE]),
ALL(Categories)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






The REMOVEFILTER option is importand because I'm filter by DATE on the Consulta Table, I try:
PreviousMonth = CALCULATE(
SUM(Consulta[CONTEO MES ACTUAL]),
PREVIOUSMONTH(Consulta[FECHA]),
REMOVEFILTERS(Consulta),
ALL(Categorias)
)
But it show me 43 on all categories.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.