Forum Discussion

SniperPro's avatar
SniperPro
Frequent Visitor
3 years ago

Calculating YTD while keeping Month filter

I have bellow table data: 

 

 

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 :

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

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

6 Replies

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

  • 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?
    • SniperPro's avatar
      SniperPro
      Frequent Visitor

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

      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 :

       

      • FreemanZ's avatar
        FreemanZ
        Super User

        hi SniperPro 

        try like:

         

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

         

         

        it worked like: