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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
The_Clam
Helper I
Helper I

Please Help! - Table of Counts Showing Counts, Zero, or BLANKS

Hi. I need help showing a table of ID counts by month for the current year.  The problem I am having though is I need to show all the months of the year (JAN 2023 - DEC 2023) even though some haven't happened yet. I am trying to give a SCORECARD look and feel.  All the months of the year should show a count, a zero, or be BLANK. 

So in my example:

Thanks!

1 ACCEPTED SOLUTION
v-rongtiep-msft
Community Support
Community Support

Hi @The_Clam ,

Please refer to my pbix file to see if it helps you.

Create a measure.

Measure2 =
VAR _cur_month =
    MONTH ( TODAY () )
VAR _cur_year_month =
    YEAR ( TODAY () ) * 100
        + MONTH ( TODAY () )
VAR _year_month =
    SELECTEDVALUE ( 'DateTable'[MonthYearSort] )
VAR _count =
    CALCULATE (
        COUNT ( Sheet1[ID] ),
        FILTER (
            ALL ( Sheet1 ),
            Sheet1[year] = SELECTEDVALUE ( Sheet1[year] )
                && Sheet1[MONTH] = SELECTEDVALUE ( Sheet1[MONTH] )
        )
    ) + 0
VAR _result =
    IF ( _year_month <= _cur_year_month, _count )
RETURN
    _result

vpollymsft_0-1676600983437.png

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

This measure works

Measure = if(today()<=max(DateTable[Date]),COUNTA(Sheet1[ID]),0)

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-rongtiep-msft
Community Support
Community Support

Hi @The_Clam ,

Please refer to my pbix file to see if it helps you.

Create a measure.

Measure2 =
VAR _cur_month =
    MONTH ( TODAY () )
VAR _cur_year_month =
    YEAR ( TODAY () ) * 100
        + MONTH ( TODAY () )
VAR _year_month =
    SELECTEDVALUE ( 'DateTable'[MonthYearSort] )
VAR _count =
    CALCULATE (
        COUNT ( Sheet1[ID] ),
        FILTER (
            ALL ( Sheet1 ),
            Sheet1[year] = SELECTEDVALUE ( Sheet1[year] )
                && Sheet1[MONTH] = SELECTEDVALUE ( Sheet1[MONTH] )
        )
    ) + 0
VAR _result =
    IF ( _year_month <= _cur_year_month, _count )
RETURN
    _result

vpollymsft_0-1676600983437.png

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.