0
votes

i am using the powerBI tools (powerpivot) to create a data model. i am done the model. the model include the product, customer dimensions and sales fact table. i have made the relationship and hierarchy in the model. now i have a requirement to show the total revenue of all the customer who brought product 1,2,3.

for example customer A brought product 1 and product 5 and the total revenue from this customer is 50 so i want to show 50 as a result

customer B bought product 4 and i do not want to include this customer in my output.

i can do the same in microstratergy using relationship filter but how can i do the same in powerpivot or powerview or powerBI.

Please help Thanks in Advance

2
Can you add data model to question? Also can you elaborate on desired result. Do you need total revenue of customer or revenue generated from product 1,3, 5 only?Abhijeet Nagre
I Want the total revenue of the customer not the revenue generated from the product 1,3,5 onlyAtul Bansal

2 Answers

1
votes
  1. In PowerPivot, relate Sales table with Customer table (Lookup table) and Relate Sales table to Product table (Lookup table).
  2. Create following two measures

    [HasPurchased X Products] =
    OR (
        OR (
            CONTAINS ( Sales, Sales[ProductID], 1 ),
            CONTAINS ( Sales, Sales[ProductID], 3 )
        ),
        CONTAINS ( Sales, Sales[ProductID], 5 )
    )
    
    [DesiredMeasure] = 
    IF (
        Sales[HasPurchased X Products] = TRUE (),
        SUM ( [Amount] ),
        BLANK ()
    )
    
  3. Select Customers in ROWS and add [DesiredMeasure] in VALUES, pivot table will show desired result.

0
votes

Additionally to what Abhijeet said, which is a nice robust solution, you might also just filter the chart in Power View. Assuming you have a relationship between sales and products table, you can select the chart in Power View, open the Filters pane, select per chart filters, add Product to the chart filters and filter to include only productions 1,2,3. This will automatically calculate the measure. Now Abhijeet's solution is better if you need that calculation to be reused. This solution works great if you're in a 'what if' scenario where you'd like to say "what are the sales for products 1,2,3" and in another breath say "actually i'm interested in sales for products 2,3 only, so me that instead.".

HTH, -Lukasz

http://dev.powerbi.com

http://blogs.msdn.com/powerbidev