top of page
Writer's pictureImran Haq

Snapshot YTD

Updated: Sep 27, 2021

A variation of the standard YTD measure

 

Snapshot YTD


This measure is used for scenarios where you have non-standard snapshot calendar (13-14 months) and within each snapshot resides a standard 12-month Calendar.


Snapshot YTD = 
-- Get latest complete months
VAR _LatestMTD =
    MAX ( Dates[LatestMTD] )  
-- Selected Snapshot      
VAR _SelectedSnapshot =
    SELECTEDVALUE ( Snapshot[SnapshotKEY] )        
-- Last Snapshot
VAR _MaxSnapshot =
    MAX ( Snapshot[SnapshotKEY] )                
VAR _Result =
-- Removes Snapshot filter, computes measure and maintains Date filters    
    IF (
        SELECTEDVALUE ( Snapshot[SnapshotKEY] ) <= _MaxSnapshot,
        CALCULATE (
            [Measure],
            REMOVEFILTERS ( Snapshot ),
            Snapshot[SnapshotKEY] = _SelectedSnapshot
            ,KEEPFILTERS(Dates[Date] <= _LatestMTD)
        )
    )
RETURN
    _Result

Power Business Intellisense

20 views0 comments

Comments


Post: Blog2_Post
bottom of page