Forum Discussion

ManaT's avatar
ManaT
Frequent Visitor
1 year ago
Solved

Dim Customer when used to filter gives wrong values

I have a dashboard with multiple dims and facts. I am trying to use Dim Customer [Customer] field to filter the FactMargin table. There is a relationship 1-* between the two. Now when I try to use Gr...
  • HarishKM's avatar
    1 year ago

    ManaT  Hey,
    I will below steps to troubleshoot my issue.

    your issue is related to the filtering context in Power BI and how the relationships between tables are affecting calculations:

    • Ensure that the 1-* relationship between Dim Customer and FactMargin is correctly setup and active. The filtering should propagate correctly across this relationship.
    • The measure you used:


    I will use this below dax

    CM =

    VAR CustIDs = VALUES( 'Dim Customer'[Customer] )

    RETURN

    CALCULATE(

    [Contribution Margin],

    REMOVEFILTERS('Dim Customer'),

    TREATAS(CustIDs, 'FactMargin'[customer] ))

     

    • I will reassess native measures used for Gross and Contribution Margin without REMOVEFILTERS and TREATAS to understand how context is being applied incorrectly.
    • I will also confirm that slicers are setting the context as expected without additional or hidden filter effects influencing results.

    Thanks

    Harish M
    Kindly give Kudos and accept it as solution if its solves your problem