Forum Discussion

pmadam's avatar
pmadam
Helper II
6 years ago
Solved

DAX Help

From below screenshot how do i get  col_orderstatus of max col_orderid number for same col_tnumber

 

 

Thanks,

Prathy

  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi pmadam ,

     

    Please try the below measure, it works on my desktop:

     

     

    CALCULATE(MAX('Table (5)'[Status]),FILTER('Table (5)','Table (5)'[Orderid] = CALCULATE(MAX('Table (5)'[Orderid]),ALLEXCEPT('Table (5)','Table (5)'[Number]))))

     

     

     

    Aiolos Zhao

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi pmadam ,

     

    Please try the below measure, it works on my desktop:

     

     

    CALCULATE(MAX('Table (5)'[Status]),FILTER('Table (5)','Table (5)'[Orderid] = CALCULATE(MAX('Table (5)'[Orderid]),ALLEXCEPT('Table (5)','Table (5)'[Number]))))

     

     

     

    Aiolos Zhao

  • Hi,

    Try these measure

    max_orderid = calculate(max(data[col_orderid]),allexcept(data,data[col_orderstatus]))

    order_status of max order id = if(hasonevalue(data[col_tnumber]),lookupvalue(data[col_orderstatus],data[col_tnumber],values(data[col_tnumber]),data[col_orderid],[max_orderid]),blank())

    Drag the second measure to your visual.

    Hope this helps.