Forum Discussion

MarcDT21's avatar
MarcDT21
Frequent Visitor
4 years ago
Solved

Calculated measure with filter

Hi there!  I would like to answear the qestion, "how many kilometers have been driven since the last inspection?" Was the inspection (KontrOelAdblueetc) made then it's TRUE. So I somehow need to get...
  • v-jingzhang's avatar
    v-jingzhang
    4 years ago

    Hi MarcDT21 

     

    I didn't know what FZ column represents for so I ignored that in previous reply. Anyway, try this new measure 2:

    Measure 2 = 
    VAR current_FZ_table = FILTER(ALL('Table'),'Table'[FZ]=SELECTEDVALUE('Table'[FZ]))
    VAR last_true_date = MAXX(FILTER(current_FZ_table,'Table'[KontrOelAdblueect]=TRUE()),'Table'[Datum])
    VAR last_true_date_KM = MAXX(FILTER(current_FZ_table,'Table'[Datum]=last_true_date),'Table'[KMEnde])
    VAR last_date = MAXX(current_FZ_table,'Table'[Datum])
    VAR last_date_KM = MAXX(FILTER(current_FZ_table,'Table'[Datum]=last_date),[KMEnde])
    RETURN
    last_date_KM - last_true_date_KM

     

    Regards,
    Jing
    If this post helps, please Accept it as Solution to help other members find it.