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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
I am trying to calculate minimum start_date as IPST for a customer as below-
IPST = VAR Per=SELECTEDVALUE(Patient_Population2[Person_id])
RETURN MINX(FILTER(Patient_Population2,Patient_Population2[Person_id]=Per),Patient_Population2[start_date].[Date])
I am using a table visual.
Patient_Population2 table lists all the start_dates for a customer.
But what I am getting is a value similar to start_date column for IPST, see screen shot below
I am expecting the output to be this
The problem here is that in the call to Filter() the reference to Patient_Population2 brings in the value of the start_date as part of the filter context. So when you calcuate the first row it's filtering for the min of start_date where start_date = 11/5/2018.
One way to fix this would be to wrap the table reference in the ALL() function
IPST = VAR Per=SELECTEDVALUE(Patient_Population2[Person_id]) RETURN MINX(FILTER( ALL( Patient_Population2 ),Patient_Population2[Person_id]=Per),Patient_Population2[start_date].[Date])
A different pattern which should achieve the same effect and is slightly simpler is the following
IPST = VAR Per=SELECTEDVALUE(Patient_Population2[Person_id]) RETURN CALCULATE( MIN(Patient_Population2[start_date].[Date]), Patient_Population2[Person_id] = Per)
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 10 | |
| 5 | |
| 5 | |
| 4 | |
| 3 |