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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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