Hi! I’ve got a problem once again, this time I think it’s a huge one.
I’ve got the fact table, image below. UNIODDZIAL_ID is branch ID from dimension table about contract ID, KSOBROTY_ZLEC is contract ID, KSOBROTY_WN is cost.
Contract ID has a relationship with dimension table, which contains info about which branch has that contrant.
Here is the case. There are situation, that some branch is working on a contract for another branch. This information is in KSOOBROTY_KONTO (There is info about which branch make that cost, some some accounting informatios and info about contract id and its owner. It’s basicly account description). I want to show total costs assing to branches from contract id, so it’s not a problem, beacuse with my relation I can assign costs to the appropriate branches under the contract. But in one case i have to do it another way.
For one branch (Call it Branc X) I’ve to sum it’s cost by information from KSOOBROTY_KONTO which is incompatible with branch coming from contract id. I must have info about all costs of that branch, does not matter if it is that branchs contract or not. So what i want powerbi to do?
- Sum column KSOOBROTY_WN by branch number from KSOOBROTY_KONTO, but only for one specific branch (Sum cost by information who make that cost, skip info about which contract is it).
- In other situation use realtion and sum values by contract id but skip those costs that were included in previous counting, do not duplicate them. (Sum cost by information whose contract is it.)
I could make 2 measures, but I have to show both values in one table so it has to be one measure.
When i delete relationship and use Branch ID from info about who made that cost, I’ve got good result for Branch X, but when I make the relationship, I’ve got good resuls for all branches but not for Branch X.
For me it’s a huge problem, I feel like my brain is going to explode Please help me!