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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
KW123
Helper V
Helper V

Last Date previous month

I have this DAX for a measure

YTD Funded =
CALCULATE([What does YTD total need to be],
LASTDATE ( PREVIOUSMONTH (Dates[Date] )))

I need to calculate the value of the above measure.  In my report, the column What does YTD total need to be, as a value. However if I select the YTD funded column into the report, it just shows $0.... 

Thanks, 
1 ACCEPTED SOLUTION

Hi @KW123 ,

Do you want to get the values from the beginning of the year to the end of the previous month? If yes, you can create a measure as below:

 

YTD Funded =
CALCULATE (
    [What does YTD total need to be],
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Date] >= DATE ( YEAR ( TODAY () ), 1, 1 )
            && 'Table'[Date] <= EOMONTH ( TODAY (), -1 )
            && 'Table'[Date] <= SELECTEDVALUE ( 'Table'[Date] )
    )
)

 

In addition, you can refer the following links to get it.

Calculate Year-to-date Values

YTD DAX

How to get a last day of previous month in Power BI

 

If the above one is not working for you, please provide some sample data(exclude sensitive data) with Text format and your expected result with special examples and screenshots. It is better if you can provide me a simplified pbix file. Thank you.

Community Support Team _ Rena
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

6 REPLIES 6
KW123
Helper V
Helper V

I have not been able to find a DAX for this anywhere online.  Any help would be appreciated! 

So I have created a column which shows me the last day of each month.  Now I'm trying to figure out how to use that to get the value from the last day of the previous month with an IF clause that gives a blank for January 2022. (since the previous month will be in 2021 and we do not have the data for it) 

Hi @KW123 ,

Do you want to get the values from the beginning of the year to the end of the previous month? If yes, you can create a measure as below:

 

YTD Funded =
CALCULATE (
    [What does YTD total need to be],
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Date] >= DATE ( YEAR ( TODAY () ), 1, 1 )
            && 'Table'[Date] <= EOMONTH ( TODAY (), -1 )
            && 'Table'[Date] <= SELECTEDVALUE ( 'Table'[Date] )
    )
)

 

In addition, you can refer the following links to get it.

Calculate Year-to-date Values

YTD DAX

How to get a last day of previous month in Power BI

 

If the above one is not working for you, please provide some sample data(exclude sensitive data) with Text format and your expected result with special examples and screenshots. It is better if you can provide me a simplified pbix file. Thank you.

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

@v-yiruan-msft Thank you so much for your help!! 
 

daXtreme
Solution Sage
Solution Sage

That's not enough information to help. Sorry.

 

Please refer to this: How to Get Your Question Answered Quickly - Microsoft Power BI Community

Hi @daXtreme 

From the screen shot, the YTD funded returns a value of $0.  For February, it should have a value, let's just say $1000 for example.  It is based off the last day of the month value of the previous month (January) of the What does YTD total need to be measure. YTD.png

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors