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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
DavOla
New Member

DAX Measures

I am trying to calculate and show sum of only the current month and not the YTD. I used this CurrentMonth = CALCULATE(SUM('YourTable'[YourColumn]), FILTER(ALL('Date'[Date]),'Date'[Date] >= STARTOFMONTH(TODAY()) && 'Date'[Date] <= TODAY())) but not working.

1 ACCEPTED SOLUTION
hackcrr
Solution Sage
Solution Sage

Hi, Your DAX metric looks correct for calculating the sum of the current month's columns. If this measure is not working as expected, ensure the following:
Date Table Relationship: Ensure that the 'Date' table contains 'YourColumn' with the table.
Date format: ensure that the t'Date' table
DateRange in the data:
Measurement Usage CurrentMonth: make sure you are using the ` measurement in the following context:

 

Best Regards,

hackcrr

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
v-yaningy-msft
Community Support
Community Support

Hi, @DavOla 

Thanks for @hackcrr reply. In fact, this function should be populated with a date column, where the Today function does not work. You can use the EOMONTH function with the TODAY function to get the date at the beginning of the month.

vyaningymsft_1-1716875956099.png

vyaningymsft_3-1716876610652.png

 


STARTOFMONTH - DAX Guide

vyaningymsft_4-1716876625932.png

DAX:

 

CurrentMonth = 
VAR _getCurrentStartMonth =
    EOMONTH ( TODAY (), -1 ) + 1
VAR _result =
    CALCULATE (
        SUM ( 'Table'[Value] ),
        FILTER (
            ALL ( 'Date'[Date] ),
            'Date'[Date] >= _getCurrentStartMonth
                && 'Date'[Date] <= TODAY ()
        )
    )
RETURN
    _result

 


Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

hackcrr
Solution Sage
Solution Sage

Hi, Your DAX metric looks correct for calculating the sum of the current month's columns. If this measure is not working as expected, ensure the following:
Date Table Relationship: Ensure that the 'Date' table contains 'YourColumn' with the table.
Date format: ensure that the t'Date' table
DateRange in the data:
Measurement Usage CurrentMonth: make sure you are using the ` measurement in the following context:

 

Best Regards,

hackcrr

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

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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