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
rdiazd73
Helper I
Helper I

PREVIOUSMONTH & DIVIDE ERROR

Hola chicos
gracias de antemano por su ayuda

Necesito el porcentaje de crecimiento o disminución de un mes a otro, el problema aparece cuando el stock del mes anterior es 0, no calcula bien, me puede ayudar gracias

Captura.JPG

_PREV M 9l ?
CALCULATE(SUM('STOCKS ES FERT'[9L]);
PREVIOUSMONTH('FiscalCalendar II'[Fecha]))

_STOCK 9L - SUMX ('STOCKS ES FERT';
«STOCKS ES FERT»[9L])


_% PREV M 9l ?
IF(SUM('STOCKS ES FERT'[9L])>0;
DIVIDE(SUMX('STOCKS ES FERT';[ _STOCK 9L]);
CALCULATE(SUM('STOCKS ES FERT'[9L]);
PREVIOUSMONTH('FiscalCalendar II'[Fecha])))-1)

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@rdiazd73 ,

Trate como

DIVIDE ([_STOCK 9L]-[_PREV M 9l]); _PREV M 9l])

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

@rdiazd73

El mes anterior es 0, por lo que el % de aumento es infinito 2/0

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@rdiazd73 ,

Trate como

DIVIDE ([_STOCK 9L]-[_PREV M 9l]); _PREV M 9l])

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hola
gracias por su ayuda
su fórmula corrige parcialmente el error, ok el porcentaje erróneo desaparece,

pero debería proponer un porcentaje de crecimiento stock anterior mes 0 stock actual 2 porcentaje de aumento + 200%, no ?

Gracias

Captura.JPG

@rdiazd73

El mes anterior es 0, por lo que el % de aumento es infinito 2/0

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Greg_Deckler
Super User
Super User

Correcto, porque se está dividiendo por cero, pero parece que está utilizando el tercer parámetro de la función DIVIDE para tener en cuenta este tipo de error, ¿verdad? Tal vez sólo probar 0 en ese tercer parámetro?


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

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.

Top Solution Authors