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! Learn more

Reply
aamulhim
New Member

Count Months that contain Values

I need to count the months that contain values to calculate the average spending.

 

The attached photo shows the months that contain values.

 

The target is to get the average spending like this (114,225 / 7 = 16,318).

 

Please help me to solve this issue> 

 

Thank you in advance. Spending by Month.jpg

 

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @aamulhim 

 

Try these:

with a separate dates table

=
CALCULATE (
    DISTINCTCOUNT ( dates[month] ),
    FILTER ( 'table', NOT ( ISBLANK ( 'table'[value] ) ) )
)

no dates table

=
CALCULATE (
    DISTINCTCOUNT ( 'dates'[month] ),
    FILTER ( 'table', NOT ( ISBLANK ( 'table'[value] ) ) )
)

if none works, please share a sample data (not an image) and  your expected result.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

5 REPLIES 5
danextian
Super User
Super User

Hi @aamulhim 

 

Try these:

with a separate dates table

=
CALCULATE (
    DISTINCTCOUNT ( dates[month] ),
    FILTER ( 'table', NOT ( ISBLANK ( 'table'[value] ) ) )
)

no dates table

=
CALCULATE (
    DISTINCTCOUNT ( 'dates'[month] ),
    FILTER ( 'table', NOT ( ISBLANK ( 'table'[value] ) ) )
)

if none works, please share a sample data (not an image) and  your expected result.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Thank you so much Dane. It works.

 

Best regards,

Ashish_Mathur
Super User
Super User

Hi,

It will depend up on the ganularity of your data.  Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi 

 

Thank you for your reply. I have attached a screenshot from the data view, I hope that will help.

 

Screenshot 2023-08-27 235620.jpg

Hi,

An image does not help.  Please share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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