locked
CALCULATE with MIN RRS feed

  • Question

  • Hi, i would like to calculate the number of my customers for the first year of Adventureworks Orderdate, so i have this mesure : ClientsDebut:=CALCULATE([NbClients]; Calendar[Year]=YEAR(FIRSTDATE(FactInternetSales[OrderDate])))

    But it doesn't work 

    So, i have tried to play with FILTER and ALL, but it doesn't work 

    Have you an idea ?

    Thanks 

    Laurent

    Sunday, December 15, 2013 11:38 AM

Answers

  • Hey Laurent,

    just check out this blogpost by Chris Webb.

    Hey counting distinct customers in the first year of business.

    I hope this helps!

    Kind Regards Matthaeus

    Monday, December 16, 2013 3:33 PM
  • I think your measure seems close to a working solution; the implicit calculate-filters (the parameter next to the measure) is stricter than an explicit filter-statement.

    Could you try the following?

    ClientsDebut=calculate([NbClients];Filter(FactInternetSales,year(FactInternetSales[OrderDate) =[First_Year]))

    with First_Year=calculate(year(FIRSTDATE(all(FactInternetSaels[OrderDate]))))

    The all may be added around the order-Date in order to always look at the first year of transactions (regardless of any date-related filters)

    I hope this helps!

    Sunday, December 15, 2013 9:44 PM

All replies

  • I think your measure seems close to a working solution; the implicit calculate-filters (the parameter next to the measure) is stricter than an explicit filter-statement.

    Could you try the following?

    ClientsDebut=calculate([NbClients];Filter(FactInternetSales,year(FactInternetSales[OrderDate) =[First_Year]))

    with First_Year=calculate(year(FIRSTDATE(all(FactInternetSaels[OrderDate]))))

    The all may be added around the order-Date in order to always look at the first year of transactions (regardless of any date-related filters)

    I hope this helps!

    Sunday, December 15, 2013 9:44 PM
  • Hey Laurent,

    just check out this blogpost by Chris Webb.

    Hey counting distinct customers in the first year of business.

    I hope this helps!

    Kind Regards Matthaeus

    Monday, December 16, 2013 3:33 PM