Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi all,
wanted to count the distinct Lead_id when it changed it state from qualified to Inactive.
attached image for refrence
Solved! Go to Solution.
Hi @rohit18 ,
Here I suggest you to try this code to create a measure.
Count =
VAR _leadid_list =
CALCULATETABLE (
VALUES ( 'Table'[lead_id] ),
FILTER (
'Table',
VAR _QualifiedDate =
CALCULATE (
MIN ( 'Table'[date] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[lead_id] ),
'Table'[change] = "Qualified"
)
)
VAR _InactiveDate =
CALCULATE (
MAX ( 'Table'[date] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[lead_id] ),
'Table'[change] = "Inactive"
&& 'Table'[date] > _QualifiedDate
)
)
RETURN
_QualifiedDate <> BLANK ()
&& _InactiveDate <> BLANK ()
)
)
RETURN
COUNTAX ( _leadid_list, [lead_id] )
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @rohit18 ,
Here I suggest you to try this code to create a measure.
Count =
VAR _leadid_list =
CALCULATETABLE (
VALUES ( 'Table'[lead_id] ),
FILTER (
'Table',
VAR _QualifiedDate =
CALCULATE (
MIN ( 'Table'[date] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[lead_id] ),
'Table'[change] = "Qualified"
)
)
VAR _InactiveDate =
CALCULATE (
MAX ( 'Table'[date] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[lead_id] ),
'Table'[change] = "Inactive"
&& 'Table'[date] > _QualifiedDate
)
)
RETURN
_QualifiedDate <> BLANK ()
&& _InactiveDate <> BLANK ()
)
)
RETURN
COUNTAX ( _leadid_list, [lead_id] )
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
12 | |
2 | |
2 | |
1 | |
1 |