Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. 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.
User | Count |
---|---|
84 | |
76 | |
74 | |
48 | |
39 |
User | Count |
---|---|
114 | |
56 | |
51 | |
42 | |
42 |