Forum Discussion

LogiFons's avatar
LogiFons
Frequent Visitor
3 years ago

Relationship with filter

Hello all.

 

I am struggling with a formula.

 

In first case i had this formula, which works.

Measurement Costs = calculate(sum(Tbl_Costs[Costs]))
 
But this will give a sum of all costs for this order.
 
 
These costs i would like to split bij Customer(Relation) name.
The relation between the working table (Costs) and the table (Relation) with the name is the relation code.
Tbl_Costs[RelatieCode]
Tbl_Relation[Rel. Code]
 

Therefor i am using the next formula: 

 

Measurement Costs with filter = calculate(sum(Tbl_Costs[Costs]),USERELATIONSHIP(Tbl_Costs[RelatieCode],Tbl_Relation[Rel. Code]),FILTER(Tbl_Relation,Tbl_Relation[Rel. Code]))
 
What do i miss in my formula?
 
Gr Alfons
 
 

1 Reply

  • It's not very clear what you are trying to acheive here. 

    I presume Tbl_Costs is the transaction table and Tbl_Relation is a dimension table?

     

    There should be a One to Many relationship between these. 

     

    If you want to see a breakdown of the measure across the categories of the Tbl_Relation  Table, you can 

     

    1. Add the Category from Tbl_Relation  to a visual and also the measure. This will autmatically filter the numbers you need

     

    2. If you want to create a measure for each Category, you can achieve this by 

     

    Measure Category =
                    Calculate([Measuremnet Costs], KEEPFILTERS(Tbl_Relation[YouCateoryName]))