Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi,
I am looking for a DAX formula that would create a count column and would return "1" or "0.5" but only return "0.5" if the person's name in my Scheduled Person column is the same 2 days in a row (back to back days) from my Appt date column. Also the Procedure needs to be equal to A and the Center needs to be equal B.
Thank you,
Solved! Go to Solution.
A solution below would have better performance :
Count3 =
VAR _patient = [Person]
VAR _date = [Date]
VAR _value =
COUNTROWS(
FILTER(
TableName,
TableName[Person]=_patient
&& TableName[Center] = "B"
&& TableName[Procedure] = "A"
&& ([Date]=_date+1 || [Date]=_date-1)
)
)
RETURN
IF(_value=1, 0.5, 1 )
hi @datatbl123
try to add a column with this:
Count2 =
VAR _patient = [Person]
VAR _date = [Date]
VAR _value =
AVERAGEX(
FILTER(
TableName,
TableName[Person]=_patient
&& TableName[Center] = "B"
&& TableName[Procedure] = "A"
),
TableName[Date]
)
RETURN
IF(_value=_date+0.5||_value=_date-0.5, 0.5,1 )
i tried and it worked like this:
A solution below would have better performance :
Count3 =
VAR _patient = [Person]
VAR _date = [Date]
VAR _value =
COUNTROWS(
FILTER(
TableName,
TableName[Person]=_patient
&& TableName[Center] = "B"
&& TableName[Procedure] = "A"
&& ([Date]=_date+1 || [Date]=_date-1)
)
)
RETURN
IF(_value=1, 0.5, 1 )
User | Count |
---|---|
10 | |
9 | |
7 | |
4 | |
4 |