JohnB
JohnB

Reputation: 11

Getting a DISTINCT Count For YTD and same period previous year based off slicer

I have a table with multiple fields, but I think the two most important are Count and Created Date. Count column is a count if an item was created. Want to work it out somehow so that I can get Results for a time period based on a slicer. i.e. If the slicer is set from Jan 1, 2024 to Jan 31 2024, it would show the Sum of all the Counts for those days AND the total count for Jan 1, 2034 to Jan 31 2023. (Not worrying about day shift). Done research and tried several different methods to get a count, but not one that will work with the slicer.

Any ideas?

Thanks.

Tried Count YTD = CALCULATE ( SUM ('v4 17 24 1'[Count]), DATESYTD ('v4 17 24 1'[Lead Created Date])) and

Count PYTD = CALCULATE(SUM('v4 17 24 1'[Count]),SAMEPERIODLASTYEAR(DATESYTD('v4 17 24 1'[Lead Created Date])))

The COUNT YTD will work, but COUNT PYTD won't change.

Upvotes: 0

Views: 232

Answers (1)

Rubrix
Rubrix

Reputation: 216

Does this work for you ?

Count PYTD =
CALCULATE (
    SUM ( 'v4 17 24 1'[Count] ),
    DATEADD ( 
        DATESYTD ( 'v4 17 24 1'[Lead Created Date] ),
        -1,
        YEAR
    )
)

Upvotes: 0

Related Questions