Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have a small data which has two tables in it. Sales table contains the two columns, Order Date, Customer Name, and Date Table contains the Date column with two years of data (2015 and 2016).
I am being required to find the No. of Customers that were there in the Last Year data as well as in the Current Year data using DAX.
Solved! Go to Solution.
I read this as the number of customers, not the number of sales, therefore distinct count would be better.
No of customers thisyear =
CALCULATE(DISTINCTCOUNT(sales[customer name]), 'Date'[Year] = YEAR(today()))
No of customers lastyear = CALCULATE(DISTINCTCOUNT(sales[customer name]), SAMEPERIODLASTYEAR'Date'[Date]')
Hi @amirabedhiafi ,
You can do the following:
This will give you number of customers by year - for both 2015 and 2016.
Thanks,
Pragati
What about using DAX?
Hi @amirabedhiafi ,
You can use following DAX:
ThisYearCount = CALCULATE(COUNT(Sales[CustomerName]), DATESYTD(Date[Date]))
LastYearCount = CALCULATE([ThisYearCount], SAMEPERIODLASTYEAR(Date[Date]))
Check if these work.
Thanks,
Pragati
I read this as the number of customers, not the number of sales, therefore distinct count would be better.
No of customers thisyear =
CALCULATE(DISTINCTCOUNT(sales[customer name]), 'Date'[Year] = YEAR(today()))
No of customers lastyear = CALCULATE(DISTINCTCOUNT(sales[customer name]), SAMEPERIODLASTYEAR'Date'[Date]')
These are the choices, I am confused which one is correct :
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
101 | |
99 | |
76 | |
67 | |
61 |
User | Count |
---|---|
142 | |
106 | |
103 | |
85 | |
70 |