Forum Discussion

tbones's avatar
tbones
Helper II
5 years ago
Solved

Sales per customer with classification/area assignment (total/%, cluster groups, and running total)

Hello and thank you so much in advance for your help. This is melting my brain since several days and I can't figure out how to solve...   First of all what is needed:   - number of "qualified" s...
  • v-robertq-msft's avatar
    5 years ago

    Hi, tbones 

    According to your description and sample pictures, I can roughly understand what you want to get, you can try my steps:

    1. Create a measure like this:
    % of customers with at least one qualified sales =
    
    DIVIDE(CALCULATE(DISTINCTCOUNT('Sales'[Account]),FILTER(ALLSELECTED(Sales),[Qualified_Sale]=1)),DISTINCTCOUNT('Sales'[Account]))
    1. Then create a silcer and place [Owner] and a card chart to place this measure, this can achieve your first requirement:

     

    1. Then create a calculated column like this:
    Sales count =
    var _count=COUNTX(FILTER(ALLSELECTED(Sales),[Account]=EARLIER(Sales[Account])&&[Qualified_Sale]=1),[ID])
    return
    SWITCH(
        TRUE(),
        _count>=4,"4+ sales",
        _count>=3,"3+ sales",
        _count>=2,"2+ sales",
        _count>=1,"1+ sales",
    "0 sales")

    And two measures like this:

    Running total = COUNTX(FILTER(ALLSELECTED(Sales),[Date]<=MAX('Sales'[Date])),[ID])
    % of all customers =
    
    var _count=COUNTX(FILTER(ALLSELECTED(Sales),[Account]=MAX(Sales[Account])&&[Qualified_Sale]=1),[ID])
    
    return
    
    DIVIDE(_count,[Running total])
    1. Then create two line chart like this, this can achieve your second requirement:

     

    And you can get what you want.

    You can download my test pbix file here

    Thank you very much!

     

    Best Regards,

    Community Support Team _Robert Qin

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.