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

GoalSeek con una medida Dax

Hola a todos,

Actualmente me enfrento al siguiente problema. Tengo un informe de ventas (en Excel) donde tengo las ventas del año hasta la fecha + previsión hasta final de año.

Result.png

Usando Goal Seek puedo calcular rápidamente cuánto necesita ganar un determinado vendedor para lograr el objetivo determinado (promedio / mes).

En el caso, Salesman1 tendría que vender en octubre, noviembre y diciembre --> El mes pasado Ventas + 593,5USD

Result.png

¿Alguien tiene una idea de cómo puedo lograr esto en power BI? El objetivo debe ser dinámico dependiendo del vendedor seleccionado.

Cualquier ayuda sería muy apreciada.

1 ACCEPTED SOLUTION
Syndicate_Admin
Administrator
Administrator

Hay @Webbizo ,

Pruebe estas medidas:

Additional Needed = 
VAR _neededavg =
    CALCULATE ( [Monthly Goal Value], REMOVEFILTERS ( 'Date' ) )
VAR _neededsum = _neededavg * 12
VAR _actualsum =
    CALCULATE ( [Amount], REMOVEFILTERS ( 'Date' ) )
VAR _nummonthsremaining =
    CALCULATE (
        12 - LASTNONBLANK ( 'Date'[Month], [Amount] ),
        REMOVEFILTERS ( 'Date' )
    )
VAR _lastmonthvalue =
    CALCULATE (
        LASTNONBLANKVALUE ( 'Date'[Month], [Amount] ),
        REMOVEFILTERS ( 'Date' )
    )
VAR _try =
    DIVIDE ( _neededsum - _actualsum, _nummonthsremaining )
RETURN
    DIVIDE ( _try - _lastmonthvalue, ( ( _nummonthsremaining + 1 ) / 2 ) )

Simulation = 
VAR _lastmonthvalue =
    CALCULATE (
        LASTNONBLANKVALUE ( 'Date'[Month], [Amount] ),
        REMOVEFILTERS ( 'Date' )
    )
VAR _thismonth =
    SELECTEDVALUE ( 'Date'[Month] )
VAR _lastmonth =
    CALCULATE ( LASTNONBLANK ( 'Date'[Month], [Amount] ), REMOVEFILTERS ( 'Date' ) )
VAR _diff = _thismonth - _lastmonth
VAR _addl = [Additional Needed] * _diff
VAR _forecast =
    IF ( ISBLANK ( [Amount] ), _lastmonthvalue + _addl, [Amount] )
RETURN
    _forecast

con una tabla de fechas para ampliar las fechas:

Date = 
ADDCOLUMNS (
    CALENDAR ( DATE ( 2021, 1, 1 ), DATE ( 2022, 1, 1 ) - 1 ),
    "Month", MONTH ( [Date] ),
    "Monthly", DATE ( YEAR ( [Date] ), MONTH ( [Date] ), 1 )
)

Para obtener un objetivo, busque que pueda ajustar y usar con múltiples vendedores:

DataZoe_0-1634748458739.pngDataZoe_1-1634748478129.png

También he adjuntado el PBIX.

View solution in original post

3 REPLIES 3
Syndicate_Admin
Administrator
Administrator

Hay @DataZoe

¡Perfección! Todavía necesito entender la lógica, pero esto es exactamente lo que estaba buscando.

Muchas gracias. Gran ayuda.

¡De nada! Hágame saber si tiene preguntas sobre la lógica para encontrar el número o el DAX utilizado.

Syndicate_Admin
Administrator
Administrator

Hay @Webbizo ,

Pruebe estas medidas:

Additional Needed = 
VAR _neededavg =
    CALCULATE ( [Monthly Goal Value], REMOVEFILTERS ( 'Date' ) )
VAR _neededsum = _neededavg * 12
VAR _actualsum =
    CALCULATE ( [Amount], REMOVEFILTERS ( 'Date' ) )
VAR _nummonthsremaining =
    CALCULATE (
        12 - LASTNONBLANK ( 'Date'[Month], [Amount] ),
        REMOVEFILTERS ( 'Date' )
    )
VAR _lastmonthvalue =
    CALCULATE (
        LASTNONBLANKVALUE ( 'Date'[Month], [Amount] ),
        REMOVEFILTERS ( 'Date' )
    )
VAR _try =
    DIVIDE ( _neededsum - _actualsum, _nummonthsremaining )
RETURN
    DIVIDE ( _try - _lastmonthvalue, ( ( _nummonthsremaining + 1 ) / 2 ) )

Simulation = 
VAR _lastmonthvalue =
    CALCULATE (
        LASTNONBLANKVALUE ( 'Date'[Month], [Amount] ),
        REMOVEFILTERS ( 'Date' )
    )
VAR _thismonth =
    SELECTEDVALUE ( 'Date'[Month] )
VAR _lastmonth =
    CALCULATE ( LASTNONBLANK ( 'Date'[Month], [Amount] ), REMOVEFILTERS ( 'Date' ) )
VAR _diff = _thismonth - _lastmonth
VAR _addl = [Additional Needed] * _diff
VAR _forecast =
    IF ( ISBLANK ( [Amount] ), _lastmonthvalue + _addl, [Amount] )
RETURN
    _forecast

con una tabla de fechas para ampliar las fechas:

Date = 
ADDCOLUMNS (
    CALENDAR ( DATE ( 2021, 1, 1 ), DATE ( 2022, 1, 1 ) - 1 ),
    "Month", MONTH ( [Date] ),
    "Monthly", DATE ( YEAR ( [Date] ), MONTH ( [Date] ), 1 )
)

Para obtener un objetivo, busque que pueda ajustar y usar con múltiples vendedores:

DataZoe_0-1634748458739.pngDataZoe_1-1634748478129.png

También he adjuntado el PBIX.

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.