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 have a dimension table called Customers, and a fact table called Sales. These are in an SSAS Tabular model.
I want to add a calculated column onto dbo customers called "next bike sale" which will show me the NEXT SalesDate from today per customer, for all productkeys of 2. So the output on the above would look like the below
Can anyone help me achieve this, some of the solutions I found online suggested using the related function but it wont work (i think because customers table filters sales table)
Solved! Go to Solution.
Hi @Anonymous ,
According to your description, if you want to get the second date after each grouping according to the customer field, you can refer to the following formula: first sort the dates according to the grouping. Then filter out the dates that meet the conditions:
rank_ =
RANKX (
FILTER ( ALL ( Sales ), Sales[customer_key] = EARLIER ( Sales[customer_key] ) ),
[sales_date],
,
ASC,
Col_data = CALCULATE (
MAX ( Sales[sales_date] ),
FILTER (
ALL ( Sales ),
Sales[rank_] = 2
&& Sales[customer_key] = EARLIER ( Sales[customer_key] )
)
)
If the problem is still not resolved, please point it out. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
According to your description, if you want to get the second date after each grouping according to the customer field, you can refer to the following formula: first sort the dates according to the grouping. Then filter out the dates that meet the conditions:
rank_ =
RANKX (
FILTER ( ALL ( Sales ), Sales[customer_key] = EARLIER ( Sales[customer_key] ) ),
[sales_date],
,
ASC,
Col_data = CALCULATE (
MAX ( Sales[sales_date] ),
FILTER (
ALL ( Sales ),
Sales[rank_] = 2
&& Sales[customer_key] = EARLIER ( Sales[customer_key] )
)
)
If the problem is still not resolved, please point it out. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous Seems like: Column = MINX(FILTER('FactTabe',[ProductKey]=2),[SalesDate])
Thanks @Greg_Deckler .. this only seems to bring back the minimum date from the table and not the minimum date per customer?
nevermind I added && customer.customerkey = sales.customerkey to the filter and I think this has worked
@Anonymous Oh, I was assuming that the tables were related to one another on customerkey. Yes, if that is not the case then you will need that additional clause.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.