Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Austen229022
Helper II
Helper II

Count of table using Measure

I am wanting to find the COUNT of dates in a column using a measure that finds which date occurs most as I am wanting to count how many times this date occurs in the table.

 

Date
01/01/2023
05/01/2023
05/01/2023
06/01/2023

Most Frequent Date: 05/01/2023

Result: 2

 

I have the current measure that I am wanting to work off

Measure - Max Date Count =
VAR T1 =
        SUMMARIZE('EW Applications','EW Applications'[Date Received],"COUNT",COUNTROWS('EW Applications'))
VAR MostRepeated =
    MAXX(T1,[COUNT])
Return
   MAXX(T1,IF([COUNT] = MostRepeated,'EW Applications'[Date Received]))
 
So what I am wanting to do is something like CALCULATE(COUNTROWS('EW Applications'),FILTER('EW Applications', 'EW Applications'[Date Received] = [Measure - Max Date Count])) though I either get the count of all rows or an error
1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

For the last measure which isn't working, you'll probably have to put the result of the first measure in a variable and use the variable in the Filter, e.g. var _mostCommon = [Measure - Max Date Count]  then pass _MostCommon to the FILTER clause

View solution in original post

4 REPLIES 4
CoreyP
Solution Sage
Solution Sage

This is the sample data I used:

CoreyP_0-1696292341265.png

This is my date count measure: 

DateCount = COUNT( EWTransactions[Date] )
 
Then I created a new measure to rank the date based on number of occurences of that date:
CoreyP_1-1696292414015.png

 

HotChilli
Super User
Super User

For the last measure which isn't working, you'll probably have to put the result of the first measure in a variable and use the variable in the Filter, e.g. var _mostCommon = [Measure - Max Date Count]  then pass _MostCommon to the FILTER clause

This worked! I knew it was somehting to do with the Measure going through the FILTER

Measure - Count Max Days =
VAR MaxDate = [Measure - Max Date Count]
RETURN
CALCULATE(COUNTROWS('EW Applications'),FILTER('EW Applications','EW Applications'[Date Received] = MaxDate))
CoreyP
Solution Sage
Solution Sage

First, create a date dimension table and establish a relationship to your fact table. Then create a measure to count the rows of the date column in your fact table. Then in your visual, add the date column from your date dimension table, and the measure of counted rows. 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors