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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Syndicate_Admin
Administrator
Administrator

El porcentaje de ventas no funciona correctamente

Hola a todos,

Mi columna % de ventas no se calcula correctamente ya que todos los números son positivos. Cualquier sugerencia es apreciada.

Gracias.

Ventas del año anteriorVentas del año en curso% de ventas
585749.19370309.781.177270912
221761.2167007.711.321801989
88842.8688607.083.159434982

El DAX que estoy usando

Ventas del año en curso =
CALCULAR(
SUMA('SEC rptRevenueAll_V'[Ventas brutas]),
FILTRO(
'SEC rptRevenueAll_V',
AÑO('SEC rptRevenueAll_V'[ActivityMonth]) = AÑO(HOY())
)
)
Ventas del año anterior =
CALCULAR(
SUMA('SEC rptRevenueAll_V'[Ventas brutas]),
FILTRO(
'SEC rptRevenueAll_V',
AÑO('SEC rptRevenueAll_V'[ActivityMonth]) = AÑO(HOY()) - 1
)
)
% de diferencia de ventas =
DIVIDIR(
[Ventas] - CALCULAR([Ventas], MISMO PERÍODOEL año pasado('SEC rptRevenueAll_V'[ActivityMonth])),
CALCULAR([Ventas], MISMO PERÍODOEL año pasado('SEC rptRevenueAll_V'[ActivityMonth]))
)
2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

¡Gracias! Eso funcionó. Agregué un poco más abajo para que fuera un número entero.

% de diferencia de ventas =
DÓNDE CurrentYearSales = [Ventas del año en curso]
DÓNDE AnteriorAñoVentas = [Ventas del año anterior]
DÓNDE Diferencia = CurrentYearSales - AnteriorAñoVentas
DEVOLUCIÓN
SI(
AnteriorAñoVentas = 0,
ESPACIO EN BLANCO(),
((Diferencia / AnteriorAñoVentas) * 100)
)
Syndicate_Admin
Administrator
Administrator

Sales % Difference = 
VAR CurrentYearSales = [Current Year Sales]
VAR PreviousYearSales = [Previous Year Sales]
VAR Difference = CurrentYearSales - PreviousYearSales
RETURN
IF(
    PreviousYearSales = 0,
    BLANK(),
    Difference / PreviousYearSales
)
//try this one might help you

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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