Forum Discussion

lherbert501's avatar
lherbert501
Post Prodigy
2 years ago
Solved

Dax Logic

Hi,   Could somebody please help me with some Dax?   Location 1 and Location 2 are theorietically the same thing but are in my system twice and I need to say, if the qty column is greater than 0 ...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi lherbert501 

    You can refer to the following solution.

    The sample data is the same as yours

    1.Create a rank column

    Rank =
    RANKX (
        FILTER (
            'Table',
            [Item] = EARLIER ( 'Table'[Item] )
                && [Date] = EARLIER ( 'Table'[Date] )
                && [Country] = EARLIER ( 'Table'[Country] )
        ),
        [Location],
        ,
        ASC
    )
    

    2.Create a result column

    Result = IF([Rank]=1,[Qty]) 

    Output

     

    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.