Forum Discussion
stfox
10 years agoHelper I
DAX: Ranking or Indexing Dates
Hi Folks I have a Pivot that creates a Cohort Anlaysis as shown on the left below. This shows the number of customer remaining in a cohort in the subsequent months (invoice months) following signup...
- 10 years ago
In this scenario, we can rank Invoice Month (from earliest month) within each Signup Month group, and use the rank number as the column group in Matrix. Please refer to following steps:
- Create a measure for the number of customers.
TotalCustomer = CALCULATE(COUNTROWS('Raw Cohort data')) - Since we will rank the month values, we need to convert the Invoice date into number.
Inv_Year&Month = VALUE ( YEAR ( 'Raw Cohort data'[Invoice_Month] ) & "0" & MONTH ( 'Raw Cohort data'[Invoice_Month] ) ) - Create a column for the rank by Inv_Year&Month within Signup month. You can see the rank in below table chart.
RankInvoiceYear&Month = RANKX ( FILTER ( 'Raw Cohort data', EARLIER ( 'Raw Cohort data'[Signup Month] ) = 'Raw Cohort data'[Signup Month] ), 'Raw Cohort data'[Inv_Year&Month], , ASC, DENSE ) - Drag below data fields into the Matrix chart. Since you already know the DAX for the % view, you can replace “RankInvoiceYear&Month” with the % view DAX and then you can get another % view Matrix.
- Create a measure for the number of customers.
mifo123
9 years agoAdvocate II
Thank you so much! This has been really helpful! :smileyhappy:
svishwanathan
8 years agoHelper III
Hello
I am posting here cos I have a similar issue. I simply want to rank my reporting date.
Reporting date Rank
1/21/2018 0
1/19/2018 -1
1/21/2018 0
1/17/2018 -2