Forum Discussion

spacerocket22's avatar
spacerocket22
Frequent Visitor
5 years ago
Solved

Dynamic Customer Grouping

I work for an organization that owns 15 companies.
1. I want to show the number of customers that purchased from 1 company, 2 companies, 3 companies, etc.
2. I also want to know the number of customers for different combinations of these companies. (Cross company customers)
3. I want this to be dynamic so when the user selects a date range on the slicer, everything updates accordingly.


A simple example of data I have:

transaction_keycustomer_keycompany_keysale_amountdate_key
123A155 
234B250 
567C390 
891B256 
987D113 


How can I achieve this in Power BI?

  • spacerocket22 , You have to create a measure

    count(Table[company_key]), As a measure, this can not be used as a filter. You need to create an independent table manually or using generateseries with 1 to 100(say). And create new measure/s that uses this table.

    Refer to my dynamic segementation video. You case = join will work no need of range unless you need a range

    https://www.youtube.com/watch?v=CuczXPj0N-k

  • spacerocket22  please try this step by step

    Step 1: create a date table

    Step 2: create a dimension table

     

    Step 3: create relationship between Dates[Date] and FactTable[date_key]. of cause, you need convert your data in column of date_key to Date Type.

     

    Step 4: create a measure

    Step 5: draw the column and measure into a tabulor visual, and date to slicer

     

    that's all.

     

9 Replies

  • spacerocket22 , You have to create a measure

    count(Table[company_key]), As a measure, this can not be used as a filter. You need to create an independent table manually or using generateseries with 1 to 100(say). And create new measure/s that uses this table.

    Refer to my dynamic segementation video. You case = join will work no need of range unless you need a range

    https://www.youtube.com/watch?v=CuczXPj0N-k

    • spacerocket22's avatar
      spacerocket22
      Frequent Visitor

      amitchandak Great video. Thanks a lot for this!!
      This solves my first question, yes. I can know the number of customers with respect to the number of companies they transact in, but I cannot know the company combinations using this. Given that there are 15 companies, the combinations are a lot. 
      I can use the same method to get combinations (manually creating a table with possible combinations) but that might be a lot of manual work and measures. Any other solutions for finding combination wise customers?

  • wdx223_Daniel's avatar
    wdx223_Daniel
    Community Champion

    spacerocket22  please try this step by step

    Step 1: create a date table

    Step 2: create a dimension table

     

    Step 3: create relationship between Dates[Date] and FactTable[date_key]. of cause, you need convert your data in column of date_key to Date Type.

     

    Step 4: create a measure

    Step 5: draw the column and measure into a tabulor visual, and date to slicer

     

    that's all.

     

    • spacerocket22's avatar
      spacerocket22
      Frequent Visitor

      wdx223_Daniel Amazingg. This workss!! 
      Any idea on how we can achieve part 2 I mentioned?
      Like finding the exact company pairs with respect to number of customers?
      For ex: 
      number of customers that buy from company 1 and company 2? 
      number of customers that buy from company 1 and company 2 and company 3?
      And all possible combinations?