The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello,
I have dataframe that looks like this:
FiscalWeek | CustomerID | Revenue |
Week1 | 1 | 10 |
Week1 | 2 | 15 |
Week1 | 1 | 34 |
Week1 | 2 | 13 |
Week1 | 3 | 15 |
Week1 | 4 | 34 |
Week1 | 5 | 52 |
Week2 | 6 | 51 |
Week2 | 7 | 61 |
Week2 | 8 | 37 |
Week2 | 1 | 10 |
Week2 | 2 | 15 |
Week2 | 3 | 34 |
Week2 | 9 | 13 |
Week3 | 7 | 15 |
Week3 | 2 | 34 |
Week3 | 1 | 52 |
Week3 | 10 | 51 |
Week3 | 11 | 61 |
Week3 | 12 | 37 |
Week3 | 13 | 10 |
Week4 | 14 | 15 |
Week4 | 15 | 34 |
Week4 | 16 | 13 |
Week4 | 12 | 15 |
Week4 | 1 | 34 |
Week4 | 8 | 52 |
Week4 | 17 | 51 |
Week5 | 18 | 61 |
Week5 | 19 | 37 |
Week5 | 20 | 10 |
Week5 | 1 | 15 |
Week5 | 2 | 34 |
Week5 | 1 | 13 |
Week5 | 21 | 15 |
Week6 | 22 | 34 |
Week6 | 23 | 52 |
Week6 | 6 | 51 |
Week6 | 4 | 61 |
Week6 | 24 | 37 |
Week6 | 25 | 54 |
Week6 | 26 | 85 |
What I am trying to get is cumulative numbers for Revenue and unique customers.
Now for the revenue it is easy however unique customers is much more complecated.
As you can customers who purchase in first week can come back and purchase again in any of the following weeks.
So the unique number of customers for each week should grow but i cant simply do the sum of unique.
So the cumulative count of unique customers for every week should be something like
count distinct values of customers since first week until now.
That being said, for week let say, 6 it would be count distinct customerID where between Week1 and Week6.
So my output should be in new table that has columns like this:
FiscalWeek | UniqueCustomerCount | TotalNetRevenue |
Week1 | 173 | |
Week2 | 221 | |
Week3 | 260 | |
Week4 | 214 | |
Week5 | 185 | |
Week6 | 374 |
How do i do this with Dax?
How would i do this?
Solved! Go to Solution.
Awesome,
thank you Kim , i think this will work well. 🙂