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.
Hi
I have three fields and would like to calculate the distinct count of active customers per year.
For example if an account purchases in 2017 and licenses expires in 2019 then it will be active for 2017,2018 and 2019
Solved! Go to Solution.
Hello @powerBIpeon (I like the name btw).
You can add a calendar table to your model using this formula: New Table >
Dates = VAR DateRange = CALENDARAUTO() RETURN ADDCOLUMNS( DateRange, "Year", YEAR([Date]) )
Then write a measure along these lines:
Active Customers = VAR MinDate = FIRSTDATE(Dates[Date]) VAR MaxDate = LASTDATE(Dates[Date]) RETURN CALCULATE( DISTINCTCOUNT(Table1[Account Name]), Table1[End Date] > MinDate, Table1[Start Date] <= MaxDate )
You will just need to change the name of the table from "Table1" to whatever the name of your table is. Then pull in the year from the Calendar table and your measure.
I uploaded my sample .PBIX file if you want to look at it. https://www.dropbox.com/s/aep680jne87rk2d/ActiveCustomerCount.pbix?dl=0
Hello @powerBIpeon (I like the name btw).
You can add a calendar table to your model using this formula: New Table >
Dates = VAR DateRange = CALENDARAUTO() RETURN ADDCOLUMNS( DateRange, "Year", YEAR([Date]) )
Then write a measure along these lines:
Active Customers = VAR MinDate = FIRSTDATE(Dates[Date]) VAR MaxDate = LASTDATE(Dates[Date]) RETURN CALCULATE( DISTINCTCOUNT(Table1[Account Name]), Table1[End Date] > MinDate, Table1[Start Date] <= MaxDate )
You will just need to change the name of the table from "Table1" to whatever the name of your table is. Then pull in the year from the Calendar table and your measure.
I uploaded my sample .PBIX file if you want to look at it. https://www.dropbox.com/s/aep680jne87rk2d/ActiveCustomerCount.pbix?dl=0
would there be a way to split the revenue amounts using that method?
For example if customer purchases a 3 year license for $300K, i want it to show $100K per year.
Yep, we can do that. Give this a try.
Amount Split = VAR MinDate = FIRSTDATE(Dates[Date]) VAR MaxDate = LASTDATE(Dates[Date]) RETURN IF ( NOT ISINSCOPE ( Dates[Year] ), SUM ( Table1[Amount] ), CALCULATE ( SUMX( Table1, DIVIDE ( Table1[Amount], DATEDIFF( Table1[Start Date], Table1[End Date], YEAR) +1 ) ), Table1[End Date] > MinDate, Table1[Start Date] <= MaxDate ) )
@jdbuchanan71 - formula works, however i just realized it actually needs to be split by months. Since accounts can sign contracts mid term. For example, if the contract started 6/2018 and ended 6/2019. That means 6 months of revenue would need to be allocated to 2018 while the other 6 months will be allocated to 2019
I tried using this solution below, but for some reason can't seem to make it work.
Hi,
Share some data (which can be pasted to an Excel file) and show the expected result.
Hi,
Share data in a form that can be pasted in an MS Excel file.
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 |
---|---|
98 | |
96 | |
78 | |
72 | |
66 |
User | Count |
---|---|
136 | |
109 | |
104 | |
82 | |
73 |