Forum Discussion

Austen229022's avatar
Austen229022
Icon for Helper II rankHelper II
2 years ago

Finding the Most Repeated Date using Multiple Criteria

Having a small issue as I am looking at finding the date that appears most in my data. This then filters another measure to count the amount of times that date appears.

This works though whenever I filter on the Regime slicer (that has 2 items) it mostly shows the correct date though the second measure isnt showing the correct amount. (see below)
This should count the amount of times that date has appeared based on the Date and the Regime Slicer

 

Here is the code used:

Max Date Count =
VAR T1 =
        SUMMARIZE('Applications','Applications'[Date Filter],"COUNT",COUNTROWS('Applications'))
VAR MostRepeated =
    MAXX(T1,[COUNT])
Return
   MAXX(T1,IF([COUNT] = MostRepeated,'Applications'[Date Filter]))
 
  
Lodgement Days =
VAR MaxDate = [Max Date Count]
RETURN
CALCULATE(COUNTROWS(Applications),FILTER('Applications', 'Applications'[Lodgement On] = MaxDate))
 
 

5 Replies

  • Austen229022 , Create a Measure and use Index function to get the top row 

     

    M1= countrows(Table) 

     

    Top Date

    maxx(index(1, allselected(Date[Date], orderBy([M1], desc)), [Date])

     

     

    Continue to explore Power BI Index function: Top/Bottom Performer by name and value- https://youtu.be/HPhzzCwe10U

    • Austen229022's avatar
      Austen229022
      Icon for Helper II rankHelper II

      Hey thank you for your response!

      Unfortunately this does not bring up what I am trying to achieve. I have found that I am needing to update the Max Date Count measure so ensure that the correct date is shown based off the Regime slicer - any thoughts?

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Icon for Super User rankSuper User

        Hi,

        Share some data to work with and show the expected result.