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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
SniperPro
Frequent Visitor

Calculating YTD while keeping Month filter

I have bellow table data: 

 

SniperPro_7-1680791470582.png

 

I want to add a measure calculating the YTD of Value so I added this measure :

Mesure = CALCULATE(SUM('Table'[Value]), DATESYTD('Calendar'[Date]))

Then in my report I filtered on the month 202302, I have the correct result puting the month and the measure :

SniperPro_6-1680791372466.png

But when I add the product it's showing two lignes : 

SniperPro_4-1680791272920.png

How can I modify the measure to have just the filtered month 202302, the product2 and Measure ytd = 3.

6 REPLIES 6
FreemanZ
Super User
Super User

hi @SniperPro 

try like:

Mesure = 
CALCULATE(
     SUM('Table'[Value]),      DATESYTD('Calendar'[Date]),
     ALL('Table'[Product])
)
 
it seems you want to ignore the Product filter, but why adding it in the visual?

hello @FreemanZ 
I want to add a month filter on the report page level :

SniperPro_0-1680861302585.png

Then I want to see the product on this month (Product2) and the YTD Value on this month alose (3) 
Below the result that I want to see :

SniperPro_1-1680861529738.png

 

hi @SniperPro 

it is always adivisable to have a dimensional date table. Supposing you have one, then try like:

Measure2 = 
CALCULATE(
     SUM(TableName[Value]),      
     DATESYTD(DateTable[Date])
)

or 

Measure3 = 
TOTALYTD(
    SUM(TableName[Value]),
    DateTable[Date]
)

it worked like:

FreemanZ_2-1680870504008.png

hi @SniperPro 

try like:

 

Measure = 
CALCULATE(
     SUM(TableName[Value]),      
     YEAR(TableName[Date])=YEAR(MAX(TableName[Date])),
     TableName[Date]<=MAX(TableName[Date])
)

 

 

it worked like:

FreemanZ_1-1680870397075.png

 

@FreemanZ Is it possible to have this same formula using the date from the related calendar table and not from the TableName.

balafbm
Advocate I
Advocate I

On the filter pane to the right, in the "Filters on this visual" section, under the Product column - > Choose Basic Filtering - > Then Choose "Product2"

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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