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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Counting number of occurences of certain word in column for each date.

Hi everyone,

 

This seems quite easy but I'm struggling so here it goes.

 

This is my table, showing the status of certain Job in a certain date. In terms of dates I have the last day for previous months and the MAX date for current month (current month equals the month we are living on right now):

obstinovsky_0-1630598494106.png

 

 

So, what I want is an evolution of the number of jobs for each [StatusDescription] for the last 12 months .

Visually it seems like this:

obstinovsky_1-1630598493802.png

 

 

I'm doing this in PowerBI but for some reason I'm not getting any result.

obstinovsky_2-1630598493789.png

 

 

Note: I want the last 12 months from Today's date.

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

Hi, @Anonymous 

 

Try to create a measure like this:

 

_Allselected_filter_first12 =
VAR _table =
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[StatusDescription] = MAX ( 'Table'[StatusDescription] )
            && EOMONTH ( 'Table'[Date], 0 ) <= EOMONTH ( TODAY (), 0 )
            && EOMONTH ( 'Table'[Date], 0 ) > EOMONTH ( TODAY (), -12 )
    )
VAR _count12 =
    IF ( COUNTROWS ( _table ) = 12, CALCULATE ( COUNT ( 'Table'[word] ), _table ) )
RETURN
    IF ( HASONEVALUE ( 'Table'[Date] ), _count12, COUNT ( 'Table'[word] ) )

 

Or, please share your sample pbix file's link here, then I can try to look into it to come up with a more accurate measure.

 

 

Hope this helps.

 

Best Regards,
Community Support Team _ Zeon Zheng
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

3 REPLIES 3
v-angzheng-msft
Community Support
Community Support

Hi, @Anonymous 

 

Try to create a measure like this:

 

_Allselected_filter_first12 =
VAR _table =
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[StatusDescription] = MAX ( 'Table'[StatusDescription] )
            && EOMONTH ( 'Table'[Date], 0 ) <= EOMONTH ( TODAY (), 0 )
            && EOMONTH ( 'Table'[Date], 0 ) > EOMONTH ( TODAY (), -12 )
    )
VAR _count12 =
    IF ( COUNTROWS ( _table ) = 12, CALCULATE ( COUNT ( 'Table'[word] ), _table ) )
RETURN
    IF ( HASONEVALUE ( 'Table'[Date] ), _count12, COUNT ( 'Table'[word] ) )

 

Or, please share your sample pbix file's link here, then I can try to look into it to come up with a more accurate measure.

 

 

Hope this helps.

 

Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

parry2k
Super User
Super User

@Anonymous very hard to understand from the images what is going on. it will be easier if you put sample data in pbix file, share it using one drive/google drive with the expected output.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k 

I can prepare a file to share later.

 

But basically I got a column that tells me the status of certain project (Open, Suspended, Closed, etc)

 

I just want to have a line chart that counts the number of projects in each status, for the Last 12 monthes.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors