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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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