Forum Discussion

Homer's avatar
Homer
New Member
5 years ago

Calculate Works until i use FILTER

Hello Guys

i'm learning DAX and i was trying to make a measure for Sales Last year with Calculate and Filter

this formula works :

 

 

 

 

 

 

Sales LY =CALCULATE([Sales CY],SAMEPERIODLASTYEAR(Date[Date]))

 

 

 

 

 

Sales LY =CALCULATE([Sales CY],SAMEPERIODLASTYEAR(Date[Date]))

 

But when i add FILTER to the measure give me the values from the current year like "Sales CY"

 

 

 

 

 

Sales LY = CALCULATE([Sales CY], Filter (Date, SAMEPERIODLASTYEAR (Date[Date]) ))

 

 

 

 

 

 

 

  • I already have a date filter on the page relative date in this year

  • the invoices Table and Date table are joined on the date of the creation of the invoice (createat)

  • Data Model

 

also i don't get the weird shapes inside the blue circles 

Any Help will much appreciated 

5 Replies

  • Homer , I hoping datedim is typo else

    it need to like this ( I have not tested these)

     

    Sales LY = CALCULATE([Sales CY], Filter (dim_date, dim_date[Date] in SAMEPERIODLASTYEAR (Date[Date]) ))

     

    or

     

    Sales LY = CALCULATE([Sales CY], Filter (Date, Date[Date] in SAMEPERIODLASTYEAR (Date[Date]) ))