Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi,
I have data model but my relationships not working well. I can't callculate customers count per item, baskets. My model looks like this:
Maybe I created wrong model, so how make it correct that I could use customers within items and baskets?
Solved! Go to Solution.
Hi @Analitika ,
You can try the following dax:
Baskets_count =
var _column=SELECTCOLUMNS('customer',"cid",'customer'[c_id])
return
COUNTX(
FILTER(ALL('Baskets'),
'Baskets'[c_id] in _column),[p_id])
Item_count =
var _customercid=SELECTCOLUMNS('customer',"cid",'customer'[c_id])
var _basketpid=SELECTCOLUMNS(FILTER('Baskets','Baskets'[c_id] in _customercid),"p_id",'Baskets'[p_id])
return
COUNTX(
FILTER(all(Items),
'Items'[p_id] in _basketpid),'Items'[item_category])
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Analitika ,
You can try the following dax:
Baskets_count =
var _column=SELECTCOLUMNS('customer',"cid",'customer'[c_id])
return
COUNTX(
FILTER(ALL('Baskets'),
'Baskets'[c_id] in _column),[p_id])
Item_count =
var _customercid=SELECTCOLUMNS('customer',"cid",'customer'[c_id])
var _basketpid=SELECTCOLUMNS(FILTER('Baskets','Baskets'[c_id] in _customercid),"p_id",'Baskets'[p_id])
return
COUNTX(
FILTER(all(Items),
'Items'[p_id] in _basketpid),'Items'[item_category])
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This model might be the reason that there is an issue. Make the customer table, the main table and have many to one relationship with the other tables.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
86 | |
85 | |
84 | |
67 | |
49 |
User | Count |
---|---|
131 | |
110 | |
97 | |
71 | |
67 |