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!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
I have a Semantic Model / Powerbi Dataset / Dimentional model with a fct.Saleslines and a dim.product.
In the fctSalesline have have an OrderID (SK_Orders) and several ProductID's (SK_Product) pr order
I want to identify all the orders, with all their products, who has a partikular kind of product.
I can do it SQL. Here is two orders (6665943 and 6665944) and all their products. One of the product in order 6665943 is a StarProduct and I want to see all the product of that order.
The SK_Order column to the right marks the all the SK_Products in the order 6665943 , where one of the products are a start product. While order 6665944 has not star products.
But how do I do that with DAX? It have to be something similar to my SQL statement, first make a filter that identifies the SK_Orders and then use the selected SK_Orders to filter the fct tabel again.
@ErikWarming
Try the following query to get the desired result:
EVALUATE
VAR __Orders =
FILTER(
fctSalesline ,
fctSalesline[SK_Order] IN { 6665943,6665944}
)
RETURN
ADDCOLUMNS(
__Orders,
"StarProducts", RELATED(dim_product[ LableGroupName_StarProducts])
,
"StarProductOrder",
VAR __Order = fctSalesline[SK_Order]
VAR __CurrOrders = FILTER( ALL(fctSalesline) , fctSalesline[SK_Order] = __Order )
RETURN
MAXX(
FILTER(
__CurrOrders,
RELATED(dim_product[ LableGroupName_StarProducts]) = 1),
fctSalesline[SK_Order]
)
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group