Forum Discussion
Issues with data model and bidirectional filters
Hi Dear Community Experts,
will be very grateful for any advice you can share on the issue based on the following data model:
As you can see I have 2 dimension (City and Code) and 2 fact tables. Coupone code is used as primary key for Code_dimension and city_id is used as primary hey for CityDimension table. Relationships are 1 to many.
The issue is the following: each row in OffAdsTable has non null Coupon code, but in some cases channel is missing. Right now with this setup, when I prepare a visual based on Channel from OffAds table and sum(discount_amount) from Coupons split table calculations are wrong as sum(discount amount) is fixed and does not change when I try to change the channel or select several channels. I tried to use bidirectrional filters, but that does not solve my problem.
Ideal solution I would expect will be some measure like Calculate(sum(discount_amount), filter context), which will enable change of calculation based on a column from one fact table to another based on relationships created with coupon code.
Please let me know if you need clarifications on the issue.
Thanks in advance!
Cheers,
Saro
Hi Anonymous ,
Please refer to my .pbix file.
Best regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
8 Replies
- parry2k
Super User
Anonymous it will be easier if you share sample data with expected output.
- AnonymousNot applicable
Hi parry2k ,
thanks so much for your reply and readiness. Attached you can see the input and expected output as tables with sample data:
Thanks again, if you need more input, please let me know!
Cheers,
Saro
- parry2k
Super User
Anonymous try this
- relationship between code dimension table with offadd table and couple split table, it will be one to many one on code dimension table,
- change relationship cross filter direction to both, between code dimension and off add table
- in table visual, drop channel and spending from off ads table and discount from coupon table
and I think that will do it.
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡