Forum Discussion
jeffgarlisch
Helper I
7 years agoDATESBETWEEN Not calculating Correctly
Hello All, Im developing a dashboard and i need to calc a YTD distinct count of IDs created this year VS Last Year e.g 2019-01-01 to 2019-02-01 AND 2018-01-01 to 2018-02-01, Data is structu...
AmanBedwal
6 years agoFrequent Visitor
You can use time intelligence functions available in Power BI (provided you have continuous DateTable).
For YTD IDs use the below measure.
IDs YTD =
TOTALYTD (
DISTINCTCOUNT ( PLASFL[MERCHANT_APPLICATION_ID] ),
DATESYTD ( DateCodeMSTR[FullDate] )
)
For previous year numbers, I am assuming that you have a date field in PLASFL table. Replace "PLASFL[Date]" with the actual date field in PLASFL table.
IDs PY =
VAR MaxDataDate =
CALCULATE ( MAX ( PLASFL[Date] ), ALL ( PLASFL ) )
RETURN
CALCULATE (
[IDs YTD],
SAMEPERIODLASTYEAR (
INTERSECT (
VALUES ( DateCodeMSTR[FullDate] ),
DATESBETWEEN ( DateCodeMSTR[FullDate], BLANK (), MaxDataDate )
)
)
)
Hope this is helpful.