Forum Discussion

Licencias's avatar
Licencias
New Member
1 year ago
Solved

MdxScript(Model) (191,13) Calculation error in measure 'Medidas'[FechaMax]

Hello everyone,

I have a problem with a measure, the context of what is needed is the following:
Be able to see the accumulated purchases based on month and year filters, that is, the user can see the accumulated purchases that have been made up to that moment depending on the filter selection.
I have filters for month and year:

A measure with which I calculate the minimum date of the calendar:

A measure with which I calculate the maximum date of the calendar, depending on the filter selection:

And the measure where I want to calculate the accumulated depending on the 2 previous measures:

The FechaMin and FechaMax functions, by themselves, are displayed correctly, but when I try to use them to filter, that's where the error appears. I hope you can help me. Thank you in advance.

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi,

    Thanks for the solution lbendlin offered and i want to offer some more information for user to refet to.

    hello Licencias , in your calendar tabe, you can create the date hierachy, then you can put the month and year in hierachy to the slicers directly.

     

    Then you can change your FechaMax measure to the following.

    FechaMax =
    CALCULATE ( MAX ( dCalendarioOC[Fecha] ), ALLSELECTED ( dCalendarioOC ) )
    

    Then change your ThisMonth to the following.

    ThisMonth =
    CALCULATE (
        [Total OC (USD)],
        DATEBETWEEN ( dCalendatioOC[Fecha], [FechaMin], [FechaMax] )
    )
    

     

     

    Best Regards!

    Yolo Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

2 Replies

  • Use EVALUATEANDLOG to chase down where these measures return either BLANK or some astronomical number.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi,

    Thanks for the solution lbendlin offered and i want to offer some more information for user to refet to.

    hello Licencias , in your calendar tabe, you can create the date hierachy, then you can put the month and year in hierachy to the slicers directly.

     

    Then you can change your FechaMax measure to the following.

    FechaMax =
    CALCULATE ( MAX ( dCalendarioOC[Fecha] ), ALLSELECTED ( dCalendarioOC ) )
    

    Then change your ThisMonth to the following.

    ThisMonth =
    CALCULATE (
        [Total OC (USD)],
        DATEBETWEEN ( dCalendatioOC[Fecha], [FechaMin], [FechaMax] )
    )
    

     

     

    Best Regards!

    Yolo Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.