Reply
sf04357
Frequent Visitor
Partially syndicated - Outbound

How to add filter for current year data upto previous month

Hi All

 

I would like to set a filter to send out the monthly report by subscription but the date filter only allow current year or last x months. It is required to send out an YTD report, but up to previous month.
Anyone know how to set?

 

Thanks

Vincent

4 REPLIES 4
sf04357
Frequent Visitor

Syndicated - Outbound

Thanks Yolo

But I still have found some problem on the display

 

You see that the table show "0" inin colunm 3 & 4 at 202301, but the actual data is showing in row 2, i.e. 202302. i.e all the data are shift one month, what will be the problem?

 

sf04357_0-1699838590607.png

 

Syndicated - Outbound

Hi @sf04357 

I don't know the expression, the data show 0 in the fiest month of the year, what the output you want?

 

Best Regards!

Yolo Zhu

Syndicated - Outbound

For data is shown in row 2 instead of row 1, i.e. the monthly data are shift

v-xinruzhu-msft
Community Support
Community Support

Syndicated - Outbound

Hi @sf04357 

1.You can use TOTALYTD() function,

e.g

 

Measure =
CALCULATE (
    TOTALYTD ( SUM ( Sales[Value] ), 'Date'[Date] ),
    'Date'[Date] < TODAY ()
)

 

And you can refer to the following link about the function.

TOTALYTD function (DAX) - DAX | Microsoft Learn

 

2.You can create a measure then put it to the visual filter

Measure =
IF (
    YEAR ( SELECTEDVALUE ( date[date] ) ) = YEAR ( TODAY () )
        && MONTH ( SELECTEDVALUE ( date[date] ) ) < MONTH ( TODAY () ),
    1,
    0
)

vxinruzhumsft_0-1699426601593.png

 

Best Regards!

Yolo Zhu

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

avatar user

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

Check out the March 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)