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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
AceB_
Regular Visitor

How can I Count the Occurence of Quarters?

I have a table that contains the names of users, and the date of payment for each one of them. 

UsersDate of payment
A12/12/2020
B3/1/2021
C9/8/2021

 

Power BI then automatically creates a hierarchy for the dates and thus shows me what the quarter is for each date. I would like to count the number of times the users have paid during each quarter.

So for example, I would like to know how many users paid us during Q1.

To do so, I need to count the number of times the quarters occur in the column, however, when I plug in this: "

Occurrence =
COUNTROWS ( FILTER( 'Table', 'Table'[Date of payment].[Quarter] = EARLIER( 'Table'[Date of payment.[Quarter] ) ) )"
The counts are completely wrong.
Any idea how to fix this?
 

 

1 ACCEPTED SOLUTION
AceB_
Regular Visitor

Solved it! Just created another table in Power Query that contains the quarters and added a column for counts, and then the values turned out correct!

View solution in original post

5 REPLIES 5
AceB_
Regular Visitor

Solved it! Just created another table in Power Query that contains the quarters and added a column for counts, and then the values turned out correct!

bhanu_gautam
Super User
Super User

Can you share PBX file to check

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Sorry I can't share the file since it contains sensitive information. However I think I identified the problem. My table now looks like this:

UserQuarterSum of occurence
AQ313
BQ313
CQ313
DQ313
EQ415
FQ123
GQ326

So the problem is that it adds up the count for each quarter  (for ex, Q3 for user G shows 26 which is 13+13), and then it adds 26 to 26 for other users etc... So it calculates it as a sum rather than a count

 

bhanu_gautam
Super User
Super User

@AceB_ , Try updating measure as 

 

Occurrence = 
CALCULATE(
    COUNTROWS('Table'),
    ALLEXCEPT('Table', 'Table'[User]),
    'Table'[Date of payment].[Quarter] = EARLIER('Table'[Date of payment].[Quarter])
)



Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Thank you for the answer!

When I plug in that measure, the occurrence shows up as a sum and this is what I get:

UsersQuarterSum of Count
AQ2155
BQ231
CQ123

The numbers are still wrong and they change from row to row

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.