Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

DAX Comparing counts from two different snapshots

Hi all,   This should be quite straightforward, but I can't seem to be able to debug it yet...  I have a series of data called 'Opportunities' that are recorded in an excel spreadsheet.   Opp...
  • ERD's avatar
    4 years ago

    Hi Anonymous ,

    I'm not sure what you want to achieve:

    Do you want to compare the values between the LATEST day available in a table and a day you choose in a slicer?

    If so:

    LatestDateCount =
    VAR LatestDate = MAXX ( ALL ( 'Table' ), 'Table'[Date Captured] )
    VAR LatestDateCount = CALCULATE ( [Opportunties_Count], 'Table'[Date Captured] = LatestDate )
    RETURN
        LatestDateCount
    
    EarlierDateCount =
    VAR EarlierDate = SELECTEDVALUE ( 'Table'[Date Captured] )
    VAR EarlierDateCount = CALCULATE ( [Opportunties_Count], 'Table'[Date Captured] = EarlierDate )
    RETURN
        EarlierDateCount
    

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