Show Days Before Or After A Selected Date - Advanced Power BI Visual Techniques

Hi,

I have watched the training module on how to show data before or after a certain date.

I now need to show a total value of the selected values only

Try the below logic…

Sales From Selected Date = 
VAR SelectedDate = CALCULATE( MAX( 'Selection Date'[Date] ), ALL( Dates ) )

RETURN
IF( HASONEVALUE( Dates[Date] ),
    IF( AND( MAX( Dates[Date] ) > SelectedDate - [Day Number] , MAX( Dates[Date] ) <= SelectedDate ),
        [Total Sales],
            BLANK() ),
                CALCULATE( [Total Sales], 
                    FILTER( ALL( Dates ),
                    Dates[Date] > SelectedDate - [Day Number] &&
                    Dates[Date] <= SelectedDate ) ) )

This should do it I believe

Thanks
Sam

Thank you so much. Solution works perfect.