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
Haripinnoju
Frequent Visitor

dax query to count the number of quarters for different years

Hi, 
I need a dax query that count the number of quarters based on the quarters and years data, it must not be distinct.
eg. year 2020 quarters Q1, Q2, Q3, Q4 No.of quarters: 4

if selected 2years in the slicer then:

2020 has four quarters data called Q1, Q2, Q3, Q4

2021 has three quarters data called Q1, Q2, Q3

so, the overall count of quarters must be 7.

Similarly, for all the selected years. - count of years and each year how many quarters it is has.

It needs to show the count. It should not count the blanks.

Haripriya1219_0-1687508139329.png

here- when taken distinct count of quarter it shows 5 which is not expected, when taken count of quarter it shows the count of quarter records and led to 99 count. I expect the count to be 8- 2years and they have 4quarters each so the count should be 2*4=8.

   

 

 

Thank you for your help in advance!

1 ACCEPTED SOLUTION

@Haripinnoju 

Measure19 =
COUNTROWS (
FILTER (
SUMMARIZE (
'vcontacts and TO SUPPLIER DOC',
'vcontacts and TO SUPPLIER DOC'[QUARTER],
'vcontacts and TO SUPPLIER DOC'[YEAR]
),
'vcontacts and TO SUPPLIER DOC'[QUARTER] <> BLANK ()
)
)

View solution in original post

4 REPLIES 4
devanshi
Helper V
Helper V

Your query is right only write COUNTROWS instead of DISTINCTCOUNT

tamerj1
Super User
Super User

Hi @Haripinnoju 

please try

Measure8 =
COUNTROWS (
SUMMARIZE (
'vcontacts and TO SUPPLIER DOC',
'vcontacts and TO SUPPLIER DOC'[QUARTER],
'vcontacts and TO SUPPLIER DOC'[YEAR]
)
)

thank you, 
how to remove the blank quarter count from it.
It must show only 8. It should count only the quarter which has data in it.

Haripinnoju_0-1687510023873.png

 

@Haripinnoju 

Measure19 =
COUNTROWS (
FILTER (
SUMMARIZE (
'vcontacts and TO SUPPLIER DOC',
'vcontacts and TO SUPPLIER DOC'[QUARTER],
'vcontacts and TO SUPPLIER DOC'[YEAR]
),
'vcontacts and TO SUPPLIER DOC'[QUARTER] <> BLANK ()
)
)

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.