Forum Discussion

jrhessey's avatar
jrhessey
Frequent Visitor
6 years ago
Solved

Row Number by table group

I'm trying to get a day count inside of a grouped by sum table.  I've found some posts here that I think give me a row number in the whole table, not the distinct rows in the summed table.  As you ca...
  • rajulshah's avatar
    6 years ago

    Hello jrhessey,

     

    You can create a measure as below:

     

    Index = RANKX(ALLSELECTED(RowNum[RunDate]),CALCULATE(FIRSTDATE(RowNum[RunDate])),,ASC,Dense)

     

     

    And then the below DAX query will help you:

     

    Average Daily Invoice = 
    VAR MTDInvoice = TOTALMTD(SUM(RowNum[Daily Invoice]),RowNum[RunDate])
    RETURN DIVIDE(MTDInvoice,[Index])

     

     

     

    Hope this helps.