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!View all the Fabric Data Days sessions on demand. View schedule
=
IF (
order_details[PRODUCT_CATEGORY] = "Trial",
0,
IF (
order_details[PRODUCT_CATEGORY] = "Trial Completion",
1,
IF (
order_details[PRODUCT_CATEGORY] <> "Rebill",
-5,
RANKX (
FILTER (
order_details,
order_details[Unique_Key] = EARLIER ( order_details[Unique_Key] )
&& RELATED ( products[PRODUCT_CATEGORY] ) = "Rebill"
&& order_details[ORDER_STATUS] <> "DECLINED"
&& order_details[IS_TEST_ACTUAL] = "N"
),
order_details[order_id],
,
ASC
) + 1,
)
)
)
)
Hi, @Anonymous
For now, your dax formula involves two or more tables. In powerbi M query, you will most likely need to create a new query to associate the two tables(order_details and products). It is recommended to provide sample data for further research.
Best Regards,
Community Support Team _ Eason
Hi,
lets say, this is from one table.
=
IF (
order_details[PRODUCT_CATEGORY] = "Trial",
0,
IF (
order_details[PRODUCT_CATEGORY] = "Trial Completion",
1,
IF (
order_details[PRODUCT_CATEGORY] <> "Rebill",
-5,
RANKX (
FILTER (
order_details,
order_details[Unique_Key] = EARLIER ( order_details[Unique_Key] )
&& order_details[PRODUCT_CATEGORY] = "Rebill"
&& order_details[ORDER_STATUS] <> "DECLINED"
&& order_details[IS_TEST_ACTUAL] = "N"
),
order_details[order_id],
,
ASC
) + 1,
)
)
)
)
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!