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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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.










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


Proud to be a Super User!









"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.










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


Proud to be a Super User!









"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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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