Forum Discussion

hellovaras's avatar
hellovaras
Regular Visitor
7 years ago

DISTINCT COUNT AND GROUP BY

Hello everyone!

 

I have a list of customer who have started with our business in different months during this year. I want to be able to show the count difference from the previous month.

 

Exmple:

Jan = 55 customer

Feb = 60 customers

 

So for Feb, I want to show 5 "new" customers. I would like to chart this for the remainder of the year. 

 

How would I do this?

 

I have start dates for each customer but can't get the DAX to count per month (get a total) and subtract that from the previous months total. 

 

Thank you for your help

1 Reply

  • hellovaras add date dimension in your model (there are many posts on how to do it), set relationship between your date dimension and customer table on start date.

     

    add following measure to achieve the result

     

    Total Customer = COUNTROWS(TableCustomer)
    
    Total Customer PM = CALCULATE( [Total Customer], PREVIOUSMONTH( DateDimenstion[Date] ) 
    
    Difference = [Total Customer] - [Total Customer PM]

    Put month from x-axis from date dimension and difference measure on value