Forum Discussion

jameshoneywill's avatar
jameshoneywill
Frequent Visitor
3 years ago
Solved

Product Gap Analysis

Hi 

I have made a simple measure to calculate whether a customer buys a product last month or not, 

GAP Product A =

IF(CALCULATE(
    [BilledGrossProfit],
        filter(
            fact_billing,
            fact_billing[Product] = "Product A"
            && Year (fact_billing[Period]) = YEAR(TODAY())
            && MONTH(fact_billing[Period]) = MONTH(TODAY()) -1       
        )
    ) > 0 , "Yes", "No" )


I also have dimension tables for Customers, and Companies (Companies are our different business names as we are a group) 

The results work when I use the customer name from my fact table but when I add the Company and Customer Name from the dimension tables it doesn't work and returns a customer for every company even though each customer only has one company providing services...

It's as if the relations are not there when they are... is there something in the dax which is locking it to the fact table only? Is there a way to 'open' it up so the other tables can be used? 

FYI the top measure  [BilledGrossProfit] when on its own works perfectly with the dimension tables 

many thanks - hopefully a simple mistake I have made... 


 
  • Its because the measure always returns a result for any combination of customer and company. Either filter the results to only show when the value is Yes or change the measure so that instead of "No" it returns BLANK().

    If you need to identify legitimate customers who did not buy the product then you would need to wrap your existing measure inside another IF statement which checks whether the current combination of company and customer is valid.

1 Reply

  • Its because the measure always returns a result for any combination of customer and company. Either filter the results to only show when the value is Yes or change the measure so that instead of "No" it returns BLANK().

    If you need to identify legitimate customers who did not buy the product then you would need to wrap your existing measure inside another IF statement which checks whether the current combination of company and customer is valid.