Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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:

 

Data_model.PNG

 

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

 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Please refer to my .pbix file.

v-lionel-msft_0-1596006090613.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
parry2k
Super User
Super User

@Anonymous it will be easier if you share sample data with expected output.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not 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: data_model_1.PNG

 

Thanks again, if you need more input, please let me know!

 

Cheers, 

Saro

Hi @Anonymous ,

 

Please refer to my .pbix file.

v-lionel-msft_0-1596006090613.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@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.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k 

 

thank you so much for your quick reply. I have tried that option. In both cases I see the following error:

 

Error.PNG

@Anonymous seems like there are other tables in the model preventing to set this relationship, I provided the information based on what you showed in excel, remove other relationship for now and test the solution. 

 

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.

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k 

really appreciate your support. In order to use the workaround you proposed I also need to remove the relationship with City Dimension table which is mentioned as input table in my second message. That is not really desired solution for me as it brakes the logic of whole dashboard. 

 

Any other option I can use for this case by keeping relationship between tables as they are and instead using some Measures?

@Anonymous you can have inactive relationship, and then create a measure use USEREALTIONSHIP function to make inactive relationship to active.

 

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.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.