Calculate max date filter another column

Hello all
I have this measure, that shows me the last date from Tab Mov, which is connected to Dates table:

CALCULATE ( MAX ( ‘Tab Mov’[DataCTB] ), ALL( ‘Tab Mov’ ))

I would like to see that date but the last date that account id starts with 2, something like:
FILTER (LEFT(TabMov [AccountID],1) =“2”

I never understood the “rules” to write these longer measures. Never which know which is first or last or…you know? Could you please be so kind and besides showing me the measure also let me know the rules for it, or some documentation or video?

Thanks a lot
Best regards
Pedro

Hi @pedroccamara,

Although you should write this as a Measure here’s a video demonstrating the basic pattern.
For your understanding it would be better if you use this to try and work it out yourself.


.

Resources to start working through:

1 Like

Ola @pedroccamara follows the link that will help you improve your notions of DAX in Power BI Desktop.

Just as @Melissa suggested, try to solve it and then post it here so we can analyze it.

Sincerely
Gefted

2 Likes

Beautiful video! Mastering DAX one of my first videos that i saw, i believe, and still no time to see the other unfortunately.
So, my measure now it’s like this (still not working), which i believe that my account ID filter should be in a VAR or outside like this? I’ve tried both, several ways and always an error.

Max Date Clients/Suppliers =
VAR Account= SELECTEDVALUE( ‘Tab Mov’[AccountID] )

RETURN
MAXX(
FILTER( ALL( ‘Tab Mov’ ), LEFT( ‘Tab Mov’[AccountID], 1 ) = “2” = Account),
‘Tab Mov’[DataCTB] )

Can you help?

.

So a double equal sign… you wanted to check if the account starts with a 2, right.

   MyMeasure =
    MAXX(
        FILTER( ALL( 'Tab Mov' ), LEFT( ‘Tab Mov’[AccountID], 1 ) = "2" ),
        'Tab Mov'[DataCTB] 
    )
1 Like

love this simple solutions…you’ve just took out the VAR from my measure. So cool!
Thank you very much @Melissa