Forum Discussion
DAX Refund Measure uses other Realationship in Modell with Wrong results
- 2 years ago
Yes, I got your file. You are getting ambiguous relationship because of multiple filter propagation paths between model tables, and you would not be able to create any active relationship. To solve this you can use user relationship function for inactive relationship. Or you can use TreatAS function, in this way you don't need to create any relationship between them.
You can create a seperate table with only channel and orderId column and create one to many relationship. Also delete channel from order table because it is meaning less. see the image below:If you don't want to create table like sheet1, then I would suggest use Treat As function in your "Refund Wrong Date" measure like below:
Refund wrong Date =CALCULATE(SUM(Refund[GrandTotal]),TREATAS(VALUES('Order'[OrderId]), Refund[OrderId]))
Use channel from order in rows and value section use measue Order and Refund wrong date.
Now if you wants to know, Channel wise total sales and refund, you will get your desired result. See image below:
When there is no active or inactive relationship, only use TreatAs function:
I have filtered out blank.When there is active relationship, both giving the same result:
So choice is yours. Now about the date from date table. You have only year 2024 in date table. Refunded value will increase if you go date wise and will decrease if you go with channel.
Because channel related to refund table using OrderID and date table related to refund table using date. 2 different type relationship.
If you manually filter refund table for only 1/3/2024 you will get 121 order and in order table you will get 56 order and I have check there is no match id between 2 tables. see image below:You are not getting any refund for 1/3/2024 using orderid from ordertable. Meaning no matching orderid between order table and refund table at that date 1/3/2024.
so completely 2 different type of relationship will produce 2 different result.
Hope this helps!!
If this solved your query, please accept it as a solution!!
Power-Central Result will depend on date in Refund table. For example, your refund table has date as 8/1/2024 and you build relationship with extracalendar or order or whatever table it is, you will only get result of 8/1/2024. All the other dates will be ignored. I would suggest you to create a calendar table and make relationship with that table to your refund table. In the table visual, place date or month or week whatever you want in the rows section from calendar table and place your sum measure in the value section. I hope you will get your result.
For further analysis, please provide your data, and expected result, so that community can check and verify.
For calendar table, you can use : Calendarauto() or CALENDAR(DATE(2023,1,1),DATE(2024,12,31)). Replace date with your desired date.
Hope this helps!!
thank you so much for supporting me.
i created a pbix file to show you me issue in practice