Forum Discussion
Star Schema problem
- 6 years ago
Hi Anonymous ,
You are right. Currently userelationship is the better way to solve this issue because your relationships between the store table and transaction table is [store id] instead of [programm id]. In this case, the result of VN06 must be 3 rather than 5 unless you choose userelationship to pass [programm] parameter.
Best Regards,
Yingjie LiIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Fair enough, here is the barebones example with the expected result:
https://drive.google.com/file/d/183cMwc8M3xgpXxYaGK_qGA31u_MaZEwa/view?usp=sharing
Just be mindful that my real model has 10+ dimensions with a few having millions of rows.
Thanks!
Hi Anonymous ,
For this scenario Crossfilter is your friend.
Try a measure like this :-
Note:- No need to change the direction of the relationships to both
Regards,
- Anonymous6 years agoNot applicable
Hey both:
"By the way, in your table, there is only three rows about VN06 so the value of VN06 should be 3, how could it be 6..." Arg you are right, that was a typo. Sorry!
Thanks a lot for your suggestions! However, both suggested solutions go via the transactions table, and both rely on us having transactions in the transaction table for each storeID that we want to count. I want to count all the stores regardless of whether transactions exist for those stores.
I created a new test file that shows this problem a little better. There are 2 stores in VN06 that have 0 transactions. The total number of stores should be 5.
https://drive.google.com/file/d/183cMwc8M3xgpXxYaGK_qGA31u_MaZEwa/view?usp=sharingThe best solution I have come up with so far is an inactive relation between Store and Program, and then this measure:
Counting_Store_UseRelationship =CALCULATE(COUNTROWS(Store),USERELATIONSHIP(ProgramID[Program ID], Store[ProgramID]))- v-yingjl6 years agoCommunity Support
Hi Anonymous ,
You are right. Currently userelationship is the better way to solve this issue because your relationships between the store table and transaction table is [store id] instead of [programm id]. In this case, the result of VN06 must be 3 rather than 5 unless you choose userelationship to pass [programm] parameter.
Best Regards,
Yingjie LiIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous6 years agoNot applicable
OK thanks,
I was just afraid that there was a better way of doing this. It must be quite rare to have multiple clients with their own transactions etc in a database together 🙂