Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hi,
I need to count unqiue values from an ID (leadid) column where that ID's datestamp (Date of First Contact) is within the previous month to today's date.
Below is an attempt to acheive this, although I have been trying a few differents ways all without success.
Solved! Go to Solution.
Hey @D_PBI ,
you can not use DATEADD, if the first parameter is not referencing a date/datetime column, for this reason you have to determine the first and last day of the previous month differently, see the measure below:
Measure 2 =
var startOfPrevMonth = EOMONTH( TODAY() , -2 ) + 1
var endOfPrevMonth = EOMONTH( TODAY() , -1)
VAR _result =
CALCULATE(
DISTINCTCOUNT( Disclosures[leadid] ) + 0,
CALCULATETABLE(
ALLSELECTED( Disclosures )
, DATESBETWEEN( Disclosures[Date of first contact] , startOfPrevMonth , endOfPrevMonth )
)
)
RETURN
_result
I'm not sure about the condition
NOT( ISBLANK( Disclosures[Date of first contact] ) )
Maybe the filter condition of datesbetween is all you need.
Nevertheless, instead of DATEADD use EOMONTH in combination with TODAY.
Hopefully, this helps to tackle your challenge.
Regards,
Tom
Hey @D_PBI ,
you can not use DATEADD, if the first parameter is not referencing a date/datetime column, for this reason you have to determine the first and last day of the previous month differently, see the measure below:
Measure 2 =
var startOfPrevMonth = EOMONTH( TODAY() , -2 ) + 1
var endOfPrevMonth = EOMONTH( TODAY() , -1)
VAR _result =
CALCULATE(
DISTINCTCOUNT( Disclosures[leadid] ) + 0,
CALCULATETABLE(
ALLSELECTED( Disclosures )
, DATESBETWEEN( Disclosures[Date of first contact] , startOfPrevMonth , endOfPrevMonth )
)
)
RETURN
_result
I'm not sure about the condition
NOT( ISBLANK( Disclosures[Date of first contact] ) )
Maybe the filter condition of datesbetween is all you need.
Nevertheless, instead of DATEADD use EOMONTH in combination with TODAY.
Hopefully, this helps to tackle your challenge.
Regards,
Tom
User | Count |
---|---|
90 | |
84 | |
66 | |
62 | |
57 |
User | Count |
---|---|
138 | |
112 | |
94 | |
82 | |
71 |