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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Sara16
Helper III
Helper III

Measure to show show count at end of current month

Hi Community

 

After some help to create a measure to get data always at the current reporting month. The count I need is based in one table and date is from a mapping table. I have tried MTD, quick measure and other code provided by the community but does not seem to be working. 

 

Essentially, the measure is to be used to calculate other data that uses a slicer reporting date field. Any help is greatly appreciated ! 🙂

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

Hi @Sara16 ,

 

Please try code as below to create a measure.

Monthly Count =
VAR _RANGESTART =
    EOMONTH ( TODAY (), -1 )
VAR _RANGEEND =
    EOMONTH ( TODAY (), 0 )
VAR _Count =
    CALCULATE (
        COUNT ( 'Table'[Date] ),
        FILTER ( 'Table', 'Table'[Date] > _RANGESTART && 'Table'[Date] <= _RANGEEND )
    )
RETURN
    _Count

My Sample:

vrzhoumsft_0-1698650493568.png

Result is as below.

vrzhoumsft_1-1698650503279.png

 

Best Regards,
Rico Zhou

 

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
Sara16
Helper III
Helper III

Thanks! It worked 🙂

v-rzhou-msft
Community Support
Community Support

Hi @Sara16 ,

 

Please try code as below to create a measure.

Monthly Count =
VAR _RANGESTART =
    EOMONTH ( TODAY (), -1 )
VAR _RANGEEND =
    EOMONTH ( TODAY (), 0 )
VAR _Count =
    CALCULATE (
        COUNT ( 'Table'[Date] ),
        FILTER ( 'Table', 'Table'[Date] > _RANGESTART && 'Table'[Date] <= _RANGEEND )
    )
RETURN
    _Count

My Sample:

vrzhoumsft_0-1698650493568.png

Result is as below.

vrzhoumsft_1-1698650503279.png

 

Best Regards,
Rico Zhou

 

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

 

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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