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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.